lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoss Man (JIRA)" <>
Subject [jira] Updated: (LUCENE-483) QueryParser.getFieldQuery(String,String) doesn't set default slop on MultiPhraseQuery
Date Thu, 05 Jan 2006 02:52:00 GMT
     [ ]

Hoss Man updated LUCENE-483:

    Attachment: LUCENE-483.patch

patch containing test changes demonstrating the problem, and the fix in both QueryParser.jj

> QueryParser.getFieldQuery(String,String) doesn't set default slop on MultiPhraseQuery
> -------------------------------------------------------------------------------------
>          Key: LUCENE-483
>          URL:
>      Project: Lucene - Java
>         Type: Bug
>     Versions: 1.9
>     Reporter: Hoss Man
>  Attachments: LUCENE-483.patch
> there seems to have been an oversight in calling mph.setSlop(phraseSlop) in QueryParser.getFieldQuery(String,String).
 The result being that in some cases, the "default slop" value doesnt' get set right (sometimes,
... see below).
> when i tried amending TestMultiAnalyzer to demonstrate the problem, I discovered that
the grammer aparently always calls getFieldQuery(String,String,int) -- even if no "~slop"
was specified in the text being parsed, in which case it passes the default as if it were
> (just to clarify: i haven't comfirmed this from a detailed reading of the grammer/code,
it's just what i've deduced based on observation of the test)
> The problem isn't entirely obvious unless you have a subclasses of QueryParser and try
to call getFieldQuery(String,String) directly.   
> In my case, I had overridden getFieldQuery(String,String) to call super.getFieldQuery(String,String)
and wrap the result in a DisjunctionMaxQuery ... I don't care about supporting the ~slop syntax,
but i do care about the default slop and i wasn't getting lucky the way QueryParser does,
because getFieldQuery(String,String,int) wasn't getting back something it could call setSlop()
with the (default) value it got from the javacc generated code.
> My description may not make much sense, but hopefull the test patch i'm about to attach
will.  The fix is also in the patch, and is fairly trivial.
> (disclaimer: i don't have javacc installed, so I tested this patch by manually making
the change to both ... it should only be commited by someone with javacc
who can regen the java file and confirm that my jj change doesn't have some weird bug in it)

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

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

View raw message