Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 65718 invoked from network); 5 Sep 2007 15:48:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Sep 2007 15:48:04 -0000 Received: (qmail 30505 invoked by uid 500); 5 Sep 2007 15:47:51 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 30422 invoked by uid 500); 5 Sep 2007 15:47:51 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 30325 invoked by uid 99); 5 Sep 2007 15:47:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2007 08:47:50 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2007 15:47:55 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C5D6271420E for ; Wed, 5 Sep 2007 08:47:34 -0700 (PDT) Message-ID: <22498524.1189007254803.JavaMail.jira@brutus> Date: Wed, 5 Sep 2007 08:47:34 -0700 (PDT) From: "Anthony Yeracaris (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Updated: (LUCENE-993) MultiFieldQueryParser doesn't process search strings containing field references correctly when BooleanClause.Occur.MUST_NOT is used In-Reply-To: <2625837.1189004856019.JavaMail.root@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Anthony Yeracaris updated LUCENE-993: ------------------------------------- Description: 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 } } } was: 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, all MUST fields must have been mentioned. 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 } } } > 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 - Java > Issue Type: Bug > Components: QueryParser, 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 is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org