-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Parsed Lucene query provider #11560
Comments
Have you tried using a Boolean query like a "must" == "AND" or "should" == "OR"? Or maybe I don't understand the request exactly. Because you can use a match and a match_all in the same Query by using the Boolean Query. Else, if it's about the search syntax from the search form then maybe you are right; I don't remember exactly. |
The match query also has an "operator" param which can be set to "AND" or "OR" (Default). |
I included "Lucene" in the title so you'd jump on it right away :D. Yes, I tried those. I didn't clarify it, but this is not about coding the query by hand but allowing the usage of the Query Parser Syntax so it can also come from a parameter. So, e.g. you can combine a search field with a more elaborate query to offer complex search. I'll open a PR in a minute and you'll see :). |
@Skrypt mentions this one https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html that we already implement and there is also this one that might be interesting, as it uses a simpler syntax |
Question is what's the difference between QueryParser and MultiField query parser. |
Indeed, I've missed that (it's not in the docs, will add it) but it doesn't seem to work as I expect. E.g. this matches an item with the exact "exploration" word in its {
"query":
{
"parsed": {
"Content.ContentItem.FullText": {
"query": "\"exploration\""
}
}
}
} This, however, doesn't match anything in the same index: {
"query":
{
"query_string": {
"query": "\"exploration\"",
"default_field": "Content.ContentItem.FullText"
}
}
} This works though: {
"query":
{
"query_string": {
"query": "Content.ContentItem.FullText:\"exploration\""
}
}
} I fixed this in the linked PR. It seems to me that the only difference notable here between |
Is your feature request related to a problem? Please describe.
You can write elaborate Lucene Queries with the ElasticSearch DSL. This includes the
match
query type (akin to using themy search term
syntax in the search box) andmatch_all
(like writing"my search term"
for exact search). And you can optionally use the parsed Lucene search syntax in the search text box. However, you can't combine the two, you can't add the ability to use the search syntax with a Query.Describe the solution you'd like
Add an
ILuceneQueryProvider
to address this.Describe alternatives you've considered
You can use simple search but then you loose out on Queries.
The text was updated successfully, but these errors were encountered: