You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "ludovic Boutros (JIRA)" <ji...@apache.org> on 2011/06/24 15:51:47 UTC
[jira] [Created] (LUCENE-3238) SpanMultiTermQueryWrapper with
Prefix Query issue
SpanMultiTermQueryWrapper with Prefix Query issue
-------------------------------------------------
Key: LUCENE-3238
URL: https://issues.apache.org/jira/browse/LUCENE-3238
Project: Lucene - Java
Issue Type: Bug
Components: core/search
Affects Versions: 3.3
Environment: Windows 7, JDK 1.6
Reporter: ludovic Boutros
If we try to do a search with SpanQuery and a PrefixQuery this message is returned:
"You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."
The problem is in the WildcardQuery rewrite function.
If the wildcard query is a prefix, a new prefix query is created, the rewrite method is set with the SpanRewriteMethod and the prefix query is returned.
But, that's the rewritten prefix query which should be returned:
- return rewritten;
+ return rewritten.rewrite(reader);
I will attach a patch with a unit test included.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3238) SpanMultiTermQueryWrapper with
Prefix Query issue
Posted by "ludovic Boutros (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054530#comment-13054530 ]
ludovic Boutros commented on LUCENE-3238:
-----------------------------------------
I understand the patch, that's better indeed. :)
Thanks.
> SpanMultiTermQueryWrapper with Prefix Query issue
> -------------------------------------------------
>
> Key: LUCENE-3238
> URL: https://issues.apache.org/jira/browse/LUCENE-3238
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/search
> Affects Versions: 3.3
> Environment: Windows 7, JDK 1.6
> Reporter: ludovic Boutros
> Assignee: Robert Muir
> Attachments: LUCENE-3238.patch, LUCENE-3238.patch, LUCENE-3238.patch
>
>
> If we try to do a search with SpanQuery and a PrefixQuery this message is returned:
> "You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."
> The problem is in the WildcardQuery rewrite function.
> If the wildcard query is a prefix, a new prefix query is created, the rewrite method is set with the SpanRewriteMethod and the prefix query is returned.
> But, that's the rewritten prefix query which should be returned:
> - return rewritten;
> + return rewritten.rewrite(reader);
> I will attach a patch with a unit test included.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Updated] (LUCENE-3238) SpanMultiTermQueryWrapper with
Prefix Query issue
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir updated LUCENE-3238:
--------------------------------
Attachment: LUCENE-3238.patch
Hi, definitely a bug, thank you!
In my opinion, WildcardQuery should not try to override MultiTermQuery's rewrite here, it causes too many problems.
Instead, in this case it should just return a PrefixTermEnum... this is the way we handle these things in trunk and I think we should fix it here the same way.
> SpanMultiTermQueryWrapper with Prefix Query issue
> -------------------------------------------------
>
> Key: LUCENE-3238
> URL: https://issues.apache.org/jira/browse/LUCENE-3238
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/search
> Affects Versions: 3.3
> Environment: Windows 7, JDK 1.6
> Reporter: ludovic Boutros
> Assignee: Robert Muir
> Attachments: LUCENE-3238.patch, LUCENE-3238.patch
>
>
> If we try to do a search with SpanQuery and a PrefixQuery this message is returned:
> "You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."
> The problem is in the WildcardQuery rewrite function.
> If the wildcard query is a prefix, a new prefix query is created, the rewrite method is set with the SpanRewriteMethod and the prefix query is returned.
> But, that's the rewritten prefix query which should be returned:
> - return rewritten;
> + return rewritten.rewrite(reader);
> I will attach a patch with a unit test included.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Updated] (LUCENE-3238) SpanMultiTermQueryWrapper with
Prefix Query issue
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir updated LUCENE-3238:
--------------------------------
Attachment: LUCENE-3238.patch
Same patch: except I made MultiTermQuery's rewrite() final.
In my opinion, this is a good backwards break, it will only fix bugs in someone's code if they have a custom MultiTermQuery: its very tricky to override this (e.g. you must pass along boost, rewriteMethod, ...), and when you do, still might cause problems (like this Span issue).
Its also much easier to just return a simpler enum.
> SpanMultiTermQueryWrapper with Prefix Query issue
> -------------------------------------------------
>
> Key: LUCENE-3238
> URL: https://issues.apache.org/jira/browse/LUCENE-3238
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/search
> Affects Versions: 3.3
> Environment: Windows 7, JDK 1.6
> Reporter: ludovic Boutros
> Assignee: Robert Muir
> Attachments: LUCENE-3238.patch, LUCENE-3238.patch, LUCENE-3238.patch
>
>
> If we try to do a search with SpanQuery and a PrefixQuery this message is returned:
> "You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."
> The problem is in the WildcardQuery rewrite function.
> If the wildcard query is a prefix, a new prefix query is created, the rewrite method is set with the SpanRewriteMethod and the prefix query is returned.
> But, that's the rewritten prefix query which should be returned:
> - return rewritten;
> + return rewritten.rewrite(reader);
> I will attach a patch with a unit test included.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3238) SpanMultiTermQueryWrapper with
Prefix Query issue
Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054466#comment-13054466 ]
Uwe Schindler commented on LUCENE-3238:
---------------------------------------
Patch is fine! Funny overlap, we both responded with same answer :-)
> SpanMultiTermQueryWrapper with Prefix Query issue
> -------------------------------------------------
>
> Key: LUCENE-3238
> URL: https://issues.apache.org/jira/browse/LUCENE-3238
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/search
> Affects Versions: 3.3
> Environment: Windows 7, JDK 1.6
> Reporter: ludovic Boutros
> Assignee: Robert Muir
> Attachments: LUCENE-3238.patch, LUCENE-3238.patch
>
>
> If we try to do a search with SpanQuery and a PrefixQuery this message is returned:
> "You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."
> The problem is in the WildcardQuery rewrite function.
> If the wildcard query is a prefix, a new prefix query is created, the rewrite method is set with the SpanRewriteMethod and the prefix query is returned.
> But, that's the rewritten prefix query which should be returned:
> - return rewritten;
> + return rewritten.rewrite(reader);
> I will attach a patch with a unit test included.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Resolved] (LUCENE-3238) SpanMultiTermQueryWrapper with
Prefix Query issue
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir resolved LUCENE-3238.
---------------------------------
Resolution: Fixed
Fix Version/s: 3.3
thanks Ludovic, nice catch!
> SpanMultiTermQueryWrapper with Prefix Query issue
> -------------------------------------------------
>
> Key: LUCENE-3238
> URL: https://issues.apache.org/jira/browse/LUCENE-3238
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/search
> Affects Versions: 3.3
> Environment: Windows 7, JDK 1.6
> Reporter: ludovic Boutros
> Assignee: Robert Muir
> Fix For: 3.3
>
> Attachments: LUCENE-3238.patch, LUCENE-3238.patch, LUCENE-3238.patch
>
>
> If we try to do a search with SpanQuery and a PrefixQuery this message is returned:
> "You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."
> The problem is in the WildcardQuery rewrite function.
> If the wildcard query is a prefix, a new prefix query is created, the rewrite method is set with the SpanRewriteMethod and the prefix query is returned.
> But, that's the rewritten prefix query which should be returned:
> - return rewritten;
> + return rewritten.rewrite(reader);
> I will attach a patch with a unit test included.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3238) SpanMultiTermQueryWrapper with
Prefix Query issue
Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054465#comment-13054465 ]
Uwe Schindler commented on LUCENE-3238:
---------------------------------------
The fix is fine, but in my optinion the problem should be solved differently.
I would like to make the rewrite method in MultiTermQuery final to prevent override. To correctly fix the issue, WildcardQuery only needs to return a PrefixTermEnum in its getEnum method. This is already fixed in Lucene 4.0.
>From looking at the code, SpanMultiTermQueryWrapper would not work correct in all cases, if the underlying query overwrites rewrite(), as the rewritten query would again have the wrong type.
> SpanMultiTermQueryWrapper with Prefix Query issue
> -------------------------------------------------
>
> Key: LUCENE-3238
> URL: https://issues.apache.org/jira/browse/LUCENE-3238
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/search
> Affects Versions: 3.3
> Environment: Windows 7, JDK 1.6
> Reporter: ludovic Boutros
> Assignee: Robert Muir
> Attachments: LUCENE-3238.patch, LUCENE-3238.patch
>
>
> If we try to do a search with SpanQuery and a PrefixQuery this message is returned:
> "You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."
> The problem is in the WildcardQuery rewrite function.
> If the wildcard query is a prefix, a new prefix query is created, the rewrite method is set with the SpanRewriteMethod and the prefix query is returned.
> But, that's the rewritten prefix query which should be returned:
> - return rewritten;
> + return rewritten.rewrite(reader);
> I will attach a patch with a unit test included.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Updated] (LUCENE-3238) SpanMultiTermQueryWrapper with
Prefix Query issue
Posted by "ludovic Boutros (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ludovic Boutros updated LUCENE-3238:
------------------------------------
Attachment: LUCENE-3238.patch
Here is the patch for the branch 3x.
> SpanMultiTermQueryWrapper with Prefix Query issue
> -------------------------------------------------
>
> Key: LUCENE-3238
> URL: https://issues.apache.org/jira/browse/LUCENE-3238
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/search
> Affects Versions: 3.3
> Environment: Windows 7, JDK 1.6
> Reporter: ludovic Boutros
> Attachments: LUCENE-3238.patch
>
>
> If we try to do a search with SpanQuery and a PrefixQuery this message is returned:
> "You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."
> The problem is in the WildcardQuery rewrite function.
> If the wildcard query is a prefix, a new prefix query is created, the rewrite method is set with the SpanRewriteMethod and the prefix query is returned.
> But, that's the rewritten prefix query which should be returned:
> - return rewritten;
> + return rewritten.rewrite(reader);
> I will attach a patch with a unit test included.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Assigned] (LUCENE-3238) SpanMultiTermQueryWrapper with
Prefix Query issue
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir reassigned LUCENE-3238:
-----------------------------------
Assignee: Robert Muir
> SpanMultiTermQueryWrapper with Prefix Query issue
> -------------------------------------------------
>
> Key: LUCENE-3238
> URL: https://issues.apache.org/jira/browse/LUCENE-3238
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/search
> Affects Versions: 3.3
> Environment: Windows 7, JDK 1.6
> Reporter: ludovic Boutros
> Assignee: Robert Muir
> Attachments: LUCENE-3238.patch
>
>
> If we try to do a search with SpanQuery and a PrefixQuery this message is returned:
> "You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."
> The problem is in the WildcardQuery rewrite function.
> If the wildcard query is a prefix, a new prefix query is created, the rewrite method is set with the SpanRewriteMethod and the prefix query is returned.
> But, that's the rewritten prefix query which should be returned:
> - return rewritten;
> + return rewritten.rewrite(reader);
> I will attach a patch with a unit test included.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org