You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Ahmed El-dawy <as...@gmail.com> on 2005/11/08 08:03:31 UTC
QueryParser with position increment > 1
Hello,
When I use QueryParser with phrase queries it makes some errors. It
assumes that positionIncrement must be 0 or 1. In my case it can be
greater than one (in case of stop words). It handles all non ONE
positionIcrement as zero.
The error is at lines 384, 385
if (t.getPositionIncrement() == 1)
positionCount++;
Must be
if (t.getPositionIncrement() != 0)
positionCount+=t.getPositionIcrement();
It assumes that the phrase "the quick brown" has only one
positionCount. "quick" returns positionIncrement=2 (handled as Zero),
and "brown" returns positionIncrement=1. It generates a BooleanQuery
instead of MultiPhraseQuery and it matches documents like "quick".
--
regards,
Ahmed Saad
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: QueryParser with position increment > 1
Posted by Daniel Naber <lu...@danielnaber.de>.
On Dienstag 08 November 2005 08:03, Ahmed El-dawy wrote:
> The error is at lines 384, 385
> if (t.getPositionIncrement() == 1)
> positionCount++;
> Must be
> if (t.getPositionIncrement() != 0)
> positionCount+=t.getPositionIcrement();
Thanks, I have committed this fix to SVN and extended the test cases in
TestMultiAnalyzer.
Regards
Daniel
--
http://www.danielnaber.de
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org