The Flexible query parser is what you are looking for: http://lucene.apache.org/core/4_0_0/queryparser/index.html
On Wed, Jan 16, 2013 at 3:46 PM, balaji.gandhi <jilaba.hin...@gmail.com>wrote: > Hi Team, > > 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)) > > I tried org.apache.lucene.queryparser.classic.QueryParser to parse the > query > and iterate over the terms. But this doesn't give me the boolean operators > and boosting. Tried to use > org.apache.lucene.queryparser.surround.parser.QueryParser and > org.apache.lucene.queryparser.surround.query.SrndQuery. I didn't see any > API > to manipulate the query. > > What would be the best way to do this? > > Thanks, > Balaji > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Parsing-a-Lucene-Solr-query-and-adding-more-clauses-tp4033973.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >