Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryString not working #10

Open
samdash opened this issue Jul 17, 2017 · 8 comments
Open

QueryString not working #10

samdash opened this issue Jul 17, 2017 · 8 comments

Comments

@samdash
Copy link

samdash commented Jul 17, 2017

<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

@PAK90
Copy link
Owner

PAK90 commented Jul 17, 2017

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

@samdash
Copy link
Author

samdash commented Jul 17, 2017

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.

@PAK90
Copy link
Owner

PAK90 commented Jul 17, 2017

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.

@samdash
Copy link
Author

samdash commented Jul 17, 2017

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 ?

@PAK90
Copy link
Owner

PAK90 commented Jul 17, 2017

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?

@samdash
Copy link
Author

samdash commented Jul 17, 2017

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.

@PAK90
Copy link
Owner

PAK90 commented Jul 17, 2017

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.

@samdash
Copy link
Author

samdash commented Jul 18, 2017

Yes i saw that, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants