[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-user
Subject:    Re: Limiting QueryParser
From:       Antony Bowesman <adb () teamware ! com>
Date:       2006-11-22 22:51:50
Message-ID: 4564D486.1000905 () teamware ! com
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic