You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Erick Erickson (JIRA)" <ji...@apache.org> on 2013/11/30 15:06:36 UTC

[jira] [Reopened] (LUCENE-993) MultiFieldQueryParser doesn't process search strings containing field references correctly when BooleanClause.Occur.MUST_NOT is used

     [ https://issues.apache.org/jira/browse/LUCENE-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Erick Erickson reopened LUCENE-993:
-----------------------------------


> MultiFieldQueryParser doesn't process search strings containing field references correctly when BooleanClause.Occur.MUST_NOT is used
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-993
>                 URL: https://issues.apache.org/jira/browse/LUCENE-993
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/queryparser, core/search
>    Affects Versions: 2.2
>            Reporter: Anthony Yeracaris
>         Attachments: MultiFieldQueryParserBug.java
>
>
> Below, and attached, is a complete java program illustrating this bug.
> In this program,I have an "allowed" field and a "restricted" field.  The user is not permitted to search the "restricted" field.  However, if the user provides the search string "allowed:value", then the MultiFieldQueryParser returns "allowed:valu -allowed:valu", which has the effect of finding nothing.
> In the case the user provides a search string containing field references, I would expect the parser to use the field and occur arrays as constraints.  In other words, if a the user mentions a field that has an occur of MUST_NOT, then that field should be elided from the search. At the end of parsing, there must be at least one search term, and all MUST fields must be present.
> import org.apache.lucene.queryParser.MultiFieldQueryParser;
> import org.apache.lucene.queryParser.ParseException;
> import org.apache.lucene.search.BooleanClause;
> import org.apache.lucene.analysis.snowball.SnowballAnalyzer;
> public class MultiFieldQueryParserBug {
>   public static void main(String[] argv) {
>     try
>     {
>       System.out.println(MultiFieldQueryParser.parse("allowed:value",
>           new String[]{"allowed", "restricted"},
>           new BooleanClause.Occur[]{BooleanClause.Occur.SHOULD, BooleanClause.Occur.MUST_NOT},
>           new SnowballAnalyzer("English")));
>       // Output is:
>       // allowed:valu -allowed:valu
>     }
>     catch (ParseException e)
>     {
>       e.printStackTrace();  // generated
>     }
>   }
> }



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org