Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-72

[PATCH] Query parser inconsistency when using terms to exclude.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.2
    • Fix Version/s: None
    • Component/s: core/queryparser
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: PC

    • Bugzilla Id:
      15739

      Description

      Hi.
      The problem I am having occurs when using queryparser and also when building the
      query using the API.
      Assume that we want to look for documents about fruits or vegetables but
      excluding tomatoes and bananas. I suppose the right query sould be:

      +(fruits vegetables) AND (-tomatoes -bananas)

      wich I think is equivalent to (if tou parse it and then print the query.toString
      ("") result that is what you get)

      +(fruits vegetables) +(-tomatoes -bananas)

      but the query doesn't work as expected, in fact the query that works is

      +(fruits vegetables) -(-tomatoes -bananas)

      which doesn´t really make much sense, because the second part seems to say:
      All documents where the condition "tomatoes is not present and bananas is not
      present " is false, which means the opposite.

      In fact, second query works as (even if they look quite opposite):
      +(fruits vegetables) -tomatoes -bananas

      Hope someone could help, thanks

        Attachments

        1. TestRegressionLucene72.java
          7 kB
          Dejan Nenov
        2. TestRegressionLucene72.java
          8 kB
          Dejan Nenov
        3. ASF.LICENSE.NOT.GRANTED--patch7.txt
          0.7 kB
          Jean-François Halleux
        4. ASF.LICENSE.NOT.GRANTED--patch6.txt
          0.8 kB
          Jean-François Halleux

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                carlos_aller@condisline.com Carlos
              • Votes:
                1 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: