lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Parsing a Lucene/Solr query and adding more clauses
Date Thu, 17 Jan 2013 01:46:26 GMT
: I am trying to write a util which can parse a Lucene/Solr query and convert
: into an object representation to add more clauses to the query. 
: 
: Eg.
: Input: (name:John AND name:Doe)
: Output: ((firstName:John OR lastName:John) AND (firstName:John OR
: lastName:John))

edismax can support this natively, no coding required -- although itwill 
build a DisjunctionMaxQuery across the "name"=>"firstName,lastName" 
expansion, not a simple BooleanQuery (but if you set the "tie" param to 
1.0 it should be equivilent, although i suspect a DisjunctionMaxQuery 
with the default tie breaker value would fit your usecase better 
anyway)...

http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2BAC8_renaming

So try something like this...

http://localhost:8983/solr/select?defType=edismax&f.name.qf=firstName+lastName&q=%28name:John%20AND%20name:Doe%29&debugQuery=true


-Hoss

Mime
View raw message