On Aug 17, 2005, at 1:50 PM, Karl Koch wrote:


Hello experts,

I have the following code:

Query query = QueryParser.parse(queryString, searchFields[0], analyser);
Hits hits = searcher.search(query);

and the following code for search across multiple fields:

Query query = MultiFieldQueryParser.parse(queryString, searchFields,
analyser);
hits = searcher.search(query);

I have some questions.

The query string in my application is of in a very simple format. Basically a number of words are separated by spaces (e.g. "dog cat"). No additional orperators (e.g. "+", OR, AND, etc. shall be used). But, I wand that all of
these terms are "OR"ed by default to maximise recall (the amount of
results). How can I do that with Lucene 1.2? (I am running the search engine on a PDA which does not allow me to go beyong version 1.2. In the Lucene Book I have found parser. I have found the setOperator(int operator) method which however works only from Lucene 1.3 onwards. Can sombod help me out?

Given your description, you don't need a query parser at all. Simply tokenize the field at whitespace boundaries (you could use an analyzer to do this if you like, or simply StringTokenizer). Then build a BooleanQuery with nested TermQuery's all unrequired which will give the OR nature.

    Erik



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to