Lucene - Core
  1. Lucene - Core
  2. LUCENE-666

TERM1 OR NOT TERM2 does not perform as expected

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0
    • Fix Version/s: None
    • Component/s: core/queryparser
    • Labels:
      None
    • Environment:

      Windows XP, JavaCC 4.0, JDK 1.5

      Description

      test:
      [junit] Testsuite: org.apache.lucene.search.TestAornotB
      [junit] Tests run: 3, Failures: 1, Errors: 0, Time elapsed: 0.39 sec

      [junit] ------------- Standard Output ---------------
      [junit] Doc1 = A B C
      [junit] Doc2 = A B C D
      [junit] Doc3 = A C D
      [junit] Doc4 = B C D
      [junit] Doc5 = C D
      [junit] -------------------------------------------------
      [junit] With query "A OR NOT B" we expect to hit
      [junit] all documents EXCEPT Doc4, instead we only match on Doc3.
      [junit] While LUCENE currently explicitly does not support queries of
      [junit] the type "find docs that do not contain TERM" - this explains
      [junit] not finding Doc5, but does not justify elimnating Doc1 and Doc2
      [junit] -------------------------------------------------
      [junit] the fix shoould likely require a modification to QueryParser.jj
      [junit] around the method:
      [junit] protected void addClause(Vector clauses, int conj, int mods, Query q)
      [junit] Query:c:a -c:b hits.length=1
      [junit] Query Found:Doc[0]= A C D
      [junit] 0.0 = (NON-MATCH) Failure to meet condition(s) of required/prohibited clause(s)
      [junit] 0.6115718 = (MATCH) fieldWeight(c:a in 1), product of:
      [junit] 1.0 = tf(termFreq(c:a)=1)
      [junit] 1.2231436 = idf(docFreq=3)
      [junit] 0.5 = fieldNorm(field=c, doc=1)
      [junit] 0.0 = match on prohibited clause (c:b)
      [junit] 0.6115718 = (MATCH) fieldWeight(c:b in 1), product of:
      [junit] 1.0 = tf(termFreq(c:b)=1)
      [junit] 1.2231436 = idf(docFreq=3)
      [junit] 0.5 = fieldNorm(field=c, doc=1)

      [junit] 0.6115718 = (MATCH) sum of:
      [junit] 0.6115718 = (MATCH) fieldWeight(c:a in 2), product of:
      [junit] 1.0 = tf(termFreq(c:a)=1)
      [junit] 1.2231436 = idf(docFreq=3)
      [junit] 0.5 = fieldNorm(field=c, doc=2)

      [junit] 0.0 = (NON-MATCH) Failure to meet condition(s) of required/prohibited clause(s)
      [junit] 0.0 = match on prohibited clause (c:b)
      [junit] 0.6115718 = (MATCH) fieldWeight(c:b in 3), product of:
      [junit] 1.0 = tf(termFreq(c:b)=1)
      [junit] 1.2231436 = idf(docFreq=3)
      [junit] 0.5 = fieldNorm(field=c, doc=3)

      [junit] Query:c:a (-c:b) hits.length=3
      [junit] Query Found:Doc[0]= A B C
      [junit] Query Found:Doc[1]= A B C D
      [junit] Query Found:Doc[2]= A C D
      [junit] 0.3057859 = (MATCH) product of:
      [junit] 0.6115718 = (MATCH) sum of:
      [junit] 0.6115718 = (MATCH) fieldWeight(c:a in 1), product of:
      [junit] 1.0 = tf(termFreq(c:a)=1)
      [junit] 1.2231436 = idf(docFreq=3)
      [junit] 0.5 = fieldNorm(field=c, doc=1)
      [junit] 0.5 = coord(1/2)

      [junit] 0.3057859 = (MATCH) product of:
      [junit] 0.6115718 = (MATCH) sum of:
      [junit] 0.6115718 = (MATCH) fieldWeight(c:a in 2), product of:
      [junit] 1.0 = tf(termFreq(c:a)=1)
      [junit] 1.2231436 = idf(docFreq=3)
      [junit] 0.5 = fieldNorm(field=c, doc=2)
      [junit] 0.5 = coord(1/2)

      [junit] 0.0 = (NON-MATCH) product of:
      [junit] 0.0 = (NON-MATCH) sum of:
      [junit] 0.0 = coord(0/2)

      [junit] ------------- ---------------- ---------------
      [junit] Testcase: testFAIL(org.apache.lucene.search.TestAornotB): FAILED
      [junit] resultDocs =A C D expected:<3> but was:<1>
      [junit] junit.framework.AssertionFailedError: resultDocs =A C D expected:<3> but was:<1>
      [junit] at org.apache.lucene.search.TestAornotB.testFAIL(TestAornotB.java:137)

      [junit] Test org.apache.lucene.search.TestAornotB FAILED

        Issue Links

          Activity

          Mark Thomas made changes -
          Workflow Default workflow, editable Closed status [ 12564045 ] jira [ 12584595 ]
          Mark Thomas made changes -
          Workflow jira [ 12382663 ] Default workflow, editable Closed status [ 12564045 ]
          Uwe Schindler made changes -
          Resolution Not A Problem [ 8 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Uwe Schindler made changes -
          Comment [ This is not a problem of QueryParser, its more a problem of the combination of SHOULD and MUST_NOT clauses in a single BooleanQuery. The first clause must be required to have the wanted effect.

          To prevent such a thing at all, I would tend to disallow MUST/SHOULD clauses in a BooleanQuery. No need to add ParseExceptions to QueryParser as the same problem would also happen to users constructing BooleanQuery programatically. ]
          Uwe Schindler made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Not A Problem [ 8 ]
          Grant Ingersoll made changes -
          Comment [ For Dejan Nenov - please use this new email address:

          d [at] panaton [dot] com

          After 10 years dejannenov@jollyobject.com is being overwhelmed by spam.

          --
          Dejan Nenov
          mobile: +1-415-999-4450
          dejannenov@jollyobject.com
          dejannenov@rocketmail.com
          Skype: dejannenov
          ]
          Grant Ingersoll made changes -
          Comment [ For Dejan Nenov - please use this new email address:

          d [at] panaton [dot] com

          After 10 years dejannenov@jollyobject.com is being overwhelmed by spam.

          --
          Dejan Nenov
          mobile: +1-415-999-4450
          dejannenov@jollyobject.com
          dejannenov@rocketmail.com
          Skype: dejannenov
          ]
          Michael Busch made changes -
          Fix Version/s 2.0.0 [ 12310853 ]
          Dejan Nenov made changes -
          Fix Version/s 2.0.0 [ 12310853 ]
          Hoss Man made changes -
          Link This issue relates to LUCENE-25 [ LUCENE-25 ]
          Hoss Man made changes -
          Field Original Value New Value
          Link This issue relates to LUCENE-72 [ LUCENE-72 ]
          Dejan Nenov created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Dejan Nenov
            • Votes:
              4 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Development