lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: About the field of PhraseQuery
Date Sat, 18 Jun 2005 07:44:02 GMT
On Friday 17 June 2005 22:27, Paul Libbrecht wrote:
> hi,
> I spent an hour today to make my field-name feed correctly into my 
> phrase-query. A ridiculous bug of mine. Debugging experience seemed to 
> indicate that the field was the field of the first term sent.
> But it struck me that the word field simply does not appear in the 
> javadoc of PhraseQuery (only as javadoc field!) whereas I would feel it 
> much more natural than a PhraseQuery be constructed or set to a 
> field-name than that it would take Terms instead of tokens...
> Or is there something I did not understand ?
> PhraseQuery certainly does not match several fields simultaneously, or ?

It will throw an IllegalArgumentException when a Term is added
with a different field, which is probably what happened.

For PhraseQuery the field name and the term text could have been
used separately in the interface, which might have prevented your bug.
For example an alternative PhraseQuery could have constructor with a
field name argument, and term texts could be added at phrase positions.

Paul Elschot

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message