mtg-hunter icon indicating copy to clipboard operation
mtg-hunter copied to clipboard

QueryString not working

Open samdash opened this issue 7 years ago • 8 comments

<SearchBox translations={{"searchbox.placeholder": "Search comments"}} queryOptions={{"minimum_should_match": this.state.matchPercent}} prefixQueryFields={["comment"]} autofocus={true} searchOnChange={true} searchThrottleTime={1000} queryFields={["comment^1"]} queryBuilder={QueryString} />

does not seem to work, can you please help, i keep getting below error message, using elastic search 5.4

{ "error": { "root_cause": [ { "type": "parsing_exception", "reason": "no [query] registered for [queryString]", "line": 1, "col": 44 } ], "type": "parsing_exception", "reason": "no [query] registered for [queryString]", "line": 1, "col": 44 }, "status": 400 }

however if i remove the queryBuilder it seems to work fine

samdash avatar Jul 17 '17 20:07 samdash

Site is still using older version of Elasticsearch, the query structure has changed for v5, hence why removing the queryBuilder fixes it.

PAK90 avatar Jul 17 '17 20:07 PAK90

Can you please let me know what needs to be change to be compatible with ES 5.4 ? really need it working for my internal demo.

samdash avatar Jul 17 '17 20:07 samdash

Oh, I missed the fact that you're using Searchkit's Searchbox component. That's been updated to v2.x to work with ES5.4, so as long as you update your Searchkit version that should be fine.

PAK90 avatar Jul 17 '17 21:07 PAK90

Yes i am using "searchkit": "^2.1.1" version, and trying to integrate QueryString, which is not working i wanted to do OR , AND, NOT ..etc so i was looking at your code and that is throwing above exception

export function QueryString(query, options:QueryStringOptions={}){
  if(!query){
    return;
  }
  // Add escapes to the query's +, - and / chars.
  query = query.replace(/\//g, "\\/").replace(/\+/g, "\\+").replace(/\-/g, "\\-");
  return {
    "queryString":assign({"fields":["name"],"query":query,"defaultOperator":"AND"})
  }
}

or does searchKit does it by default ?

samdash avatar Jul 17 '17 21:07 samdash

I'm honestly not sure, since I never actually got around to re-working my code for ES5.x. Try asking in the searchkit gitter channel for some help.

Out of curiosity, what are you trying to construct for your internal demo?

PAK90 avatar Jul 17 '17 21:07 PAK90

Demo for our time series data which is stored in ES , I like you site http://mtg-hunter.com side bar with "AND-OR" feature that you have on the side bar.

samdash avatar Jul 17 '17 21:07 samdash

Ohh I see. So the reason those work for me is that I modified some Searchkit code to let those go through. I modified the RefinementList component as well as some other ones that it depended on, this is all visible in the /src folder.

PAK90 avatar Jul 17 '17 21:07 PAK90

Yes i saw that, thanks :)

samdash avatar Jul 18 '17 01:07 samdash