Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
It will be great if Solr has a powerful query DSL. This ticket is an extension of http://yonik.com/solr-json-request-api/.
Here are several examples of Query DSL
curl -XGET http://localhost:8983/solr/query -d ' { "query" : { "lucene" : { "df" : "content", "query" : "solr lucene" } } }
the above example can be rewritten as (because lucene is the default qparser)
curl -XGET http://localhost:8983/solr/query -d ' { "query" : "content:(solr lucene)" }
more complex example:
curl -XGET http://localhost:8983/solr/query -d ' { "query" : { "boost" : { "query" : { "lucene" : { "q.op" : "AND", "df" : "cat_s", "query" : "A" } } "b" : "log(popularity)" } } }
I call it Json Query Object (JQO) and It defined as :
- It can be a valid query string for Lucene query parser, for example : "title:solr"
- It can be a valid local parameters string, for example : "
{!dismax qf=myfield}
solr rocks"
- It can be a json object with structure like this
{ "query-parser-name" : { "param1" : "value1", "param2" : "value2", "query" : <JQO>, "another-param" : <JQO> } }
Therefore the above dismax query can be rewritten as ( be noticed that the query argument in local parameters, is put as value of query field )
{ "dismax" : { "qf" : "myfield" "query" : "solr rocks" } }
I will attach an HTML, contain more examples of Query DSL.
Attachments
Attachments
Issue Links
- duplicates
-
SOLR-4351 JSON QParser integration
- Resolved
-
SOLR-9733 JSON Request filter param should support queries in JSON syntax
- Open
- is related to
-
SOLR-11295 JSON Qparser
- Open
-
SOLR-9683 include/exclude filters by tag
- Open
-
SOLR-9682 Ability to specify a query with a parameter name (in facet filter)
- Resolved
-
SOLR-9685 tag a query in JSON syntax
- Closed
-
SOLR-10144 redesign block-join support
- Closed
- relates to
-
SOLR-13808 Query DSL should let to cache filter
- Closed