You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Cao Manh Dat (JIRA)" <ji...@apache.org> on 2017/08/16 11:04:00 UTC

[jira] [Comment Edited] (SOLR-11244) Query DSL for Solr

    [ https://issues.apache.org/jira/browse/SOLR-11244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128632#comment-16128632 ] 

Cao Manh Dat edited comment on SOLR-11244 at 8/16/17 11:03 AM:
---------------------------------------------------------------

Here are a patch for this feature, it contains 
- test for json query dsls
- a boolean query parser with syntax like this
{code}
{
  "bool" : {
    "must" : [<JQO>, <JQO>, ...],
    "must_not" : [<JQO>, <JQO>, ...],
    "filter" : [<JQO>, <JQO>, ...],
    "should" : [<JQO>, <JQO>, ...]
  }
}
{code}
- the implementation of query dsl. Basically, the json query object is converted into a local parameter string. For example, the below JQO
{code}
boost : {   
	query : {    
		lucene : {           
			df : cat_s,           
			query : A         
		}   
	},     
	b : 1.5   
} 
{code}
is converted into
{code}
{!boost b=1.5 v='{!lucene df=cat_s v=A}' }
{code}


was (Author: caomanhdat):
Here are a patch for this feature, it contains 
- test for json query dsls
- a boolean query parser with syntax like this
{code}
{
  "bool" : {
    "must" : [<JQO>, <JQO>, ...],
    "must_not" : [<JQO>, <JQO>, ...],
    "filter" : [<JQO>, <JQO>, ...],
    "should" : [<JQO>, <JQO>, ...]
  }
}
{code}
- the implementation of query dsl. Basically, the json query object is converted into a local parameter string. For example, the below JQO
{code}
boost : {   
	query : {    
		lucene : {           
			df : cat_s,           
			query : A         
		}   
	},     
	b : 1.5   
} 
{code}
is converted into
{!boost b=1.5 v='{!lucene df=cat_s v=A}' }

> Query DSL for Solr
> ------------------
>
>                 Key: SOLR-11244
>                 URL: https://issues.apache.org/jira/browse/SOLR-11244
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Cao Manh Dat
>            Assignee: Cao Manh Dat
>         Attachments: SOLR-11244.patch, Solr Query DSL - examples.html
>
>
> 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 definition of Json Query Object (JQO) :
> - 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 
> {code}
> {
>   "query-parser-name" : {
>      "param1" : "value1",
>      "param2" : "value2",
>      "query" : <JQO>,
>      "another-param" : <JQO>
>   }
> }
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org