FAQ
StandardQueryParser ignores AND operator for tokenized query terms
------------------------------------------------------------------

Key: LUCENE-3542
URL: https://issues.apache.org/jira/browse/LUCENE-3542
Project: Lucene - Java
Issue Type: Bug
Components: modules/queryparser
Affects Versions: 3.4, 4.0
Reporter: Simon Willnauer
Priority: Minor
Fix For: 3.5, 4.0


The standard query parser uses the default query operator for query clauses that are created from tokenization in the query parser instead of the actual operator for the source term.

here is an example:
{code}
StandardQueryParser parser = new StandardQueryParser(new StandardAnalyzer(Version.LUCENE_34));
parser.setDefaultOperator(Operator.OR);
System.out.println(((BooleanQuery)parser.parse("_deleted:true AND title:東京", "f")));
{code}

this should yield:
+_deleted:true +(title:東 title:京)

as our former core query parser does but actually yields:
+_deleted:true title:東 title:京

seems like a bug to me, looking at the tests seems we don't test for this kind of queries in the standard query parser tests too.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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

Search Discussions

  • Simon Willnauer (Assigned) (JIRA) at Oct 29, 2011 at 9:31 pm
    [ https://issues.apache.org/jira/browse/LUCENE-3542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Simon Willnauer reassigned LUCENE-3542:
    ---------------------------------------

    Assignee: Simon Willnauer
    StandardQueryParser ignores AND operator for tokenized query terms
    ------------------------------------------------------------------

    Key: LUCENE-3542
    URL: https://issues.apache.org/jira/browse/LUCENE-3542
    Project: Lucene - Java
    Issue Type: Bug
    Components: modules/queryparser
    Affects Versions: 3.4, 4.0
    Reporter: Simon Willnauer
    Assignee: Simon Willnauer
    Priority: Minor
    Fix For: 3.5, 4.0


    The standard query parser uses the default query operator for query clauses that are created from tokenization in the query parser instead of the actual operator for the source term.
    here is an example:
    {code}
    StandardQueryParser parser = new StandardQueryParser(new StandardAnalyzer(Version.LUCENE_34));
    parser.setDefaultOperator(Operator.OR);
    System.out.println(((BooleanQuery)parser.parse("_deleted:true AND title:東京", "f")));
    {code}
    this should yield:
    +_deleted:true +(title:東 title:京)
    as our former core query parser does but actually yields:
    +_deleted:true title:東 title:京
    seems like a bug to me, looking at the tests seems we don't test for this kind of queries in the standard query parser tests too.
    --
    This message is automatically generated by JIRA.
    If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
    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
  • Simon Willnauer (Updated) (JIRA) at Oct 29, 2011 at 9:33 pm
    [ https://issues.apache.org/jira/browse/LUCENE-3542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Simon Willnauer updated LUCENE-3542:
    ------------------------------------

    Attachment: LUCENE-3542.patch

    here is a patch against 3.x - turns out that the standard query parser doesn't group expanded terms internally while our core parser does. I added a testcase for my particular case and fixed the grouping if a term gets expanded
    StandardQueryParser ignores AND operator for tokenized query terms
    ------------------------------------------------------------------

    Key: LUCENE-3542
    URL: https://issues.apache.org/jira/browse/LUCENE-3542
    Project: Lucene - Java
    Issue Type: Bug
    Components: modules/queryparser
    Affects Versions: 3.4, 4.0
    Reporter: Simon Willnauer
    Assignee: Simon Willnauer
    Priority: Minor
    Fix For: 3.5, 4.0

    Attachments: LUCENE-3542.patch


    The standard query parser uses the default query operator for query clauses that are created from tokenization in the query parser instead of the actual operator for the source term.
    here is an example:
    {code}
    StandardQueryParser parser = new StandardQueryParser(new StandardAnalyzer(Version.LUCENE_34));
    parser.setDefaultOperator(Operator.OR);
    System.out.println(((BooleanQuery)parser.parse("_deleted:true AND title:東京", "f")));
    {code}
    this should yield:
    +_deleted:true +(title:東 title:京)
    as our former core query parser does but actually yields:
    +_deleted:true title:東 title:京
    seems like a bug to me, looking at the tests seems we don't test for this kind of queries in the standard query parser tests too.
    --
    This message is automatically generated by JIRA.
    If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
    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
  • Simon Willnauer (Resolved) (JIRA) at Oct 30, 2011 at 11:21 pm
    [ https://issues.apache.org/jira/browse/LUCENE-3542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Simon Willnauer resolved LUCENE-3542.
    -------------------------------------

    Resolution: Fixed
    Lucene Fields: New,Patch Available (was: New)

    committed to trunk in r1195275
    backported to 3.x in r1195276
    StandardQueryParser ignores AND operator for tokenized query terms
    ------------------------------------------------------------------

    Key: LUCENE-3542
    URL: https://issues.apache.org/jira/browse/LUCENE-3542
    Project: Lucene - Java
    Issue Type: Bug
    Components: modules/queryparser
    Affects Versions: 3.4, 4.0
    Reporter: Simon Willnauer
    Assignee: Simon Willnauer
    Priority: Minor
    Fix For: 3.5, 4.0

    Attachments: LUCENE-3542.patch


    The standard query parser uses the default query operator for query clauses that are created from tokenization in the query parser instead of the actual operator for the source term.
    here is an example:
    {code}
    StandardQueryParser parser = new StandardQueryParser(new StandardAnalyzer(Version.LUCENE_34));
    parser.setDefaultOperator(Operator.OR);
    System.out.println(((BooleanQuery)parser.parse("_deleted:true AND title:東京", "f")));
    {code}
    this should yield:
    +_deleted:true +(title:東 title:京)
    as our former core query parser does but actually yields:
    +_deleted:true title:東 title:京
    seems like a bug to me, looking at the tests seems we don't test for this kind of queries in the standard query parser tests too.
    --
    This message is automatically generated by JIRA.
    If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categorieslucene
postedOct 29, '11 at 8:37p
activeOct 30, '11 at 11:21p
posts4
users1
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase