lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Bowesman <...@teamware.com>
Subject Re: Limiting QueryParser
Date Wed, 22 Nov 2006 22:51:50 GMT
Erik Hatcher wrote:
> 
> It doesn't seem like you need a "parser" at all for your field-specific 
> search fields.  Simply tokenize, using a Lucene Analyzer, the text field 
> and build up a BooleanQuery of all the tokens.

That's what I'm currently doing, but I was getting bogged down with trying to 
support PhraseQueries in case of quoted input.  My knowledge of JavaCC is 
limited, so I was trying to weigh up the effor of rolling my own or adapting QP.

> QueryParser is over prescribed - and is often not the best fit for the 
> job.  It's only a few lines of code to tokenize (look at the QueryParser 
> code in how it creates a PhraseQuery, for example) and build a Query 
> from the tokens.
> 
> If you need to support +/-/AND/OR syntax in your field-specific inputs 
> that's a different story - though your example does not show this need.  
> If so, copying the QueryParser.jj file and removing the "field:" syntax 
> and fixing all created Query objects to a specified single field might 
> be the trick.

I do have other levels where +- can be used, but that's the easy bit and I'm 
just constructing an outer BooleanQuery.  Anyway, I'll have a go with QP.jj and 
see where I get.  BTW, LIA is an excellent book!

Thanks everyone for your comments.
Antony



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


Mime
View raw message