Lucene - Core
  1. Lucene - Core
  2. LUCENE-2566

+ - operators allow any amount of whitespace

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6
    • Fix Version/s: 4.0-ALPHA, 3.6.1
    • Component/s: core/queryparser
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      As an example, (foo - bar) is treated like (foo -bar).
      It seems like for +- to be treated as unary operators, they should be immediately followed by the operand.

      1. LUCENE-2566.patch
        32 kB
        Yonik Seeley
      2. LUCENE-2566-3x.patch
        55 kB
        Jan Høydahl

        Activity

        Hide
        Yonik Seeley added a comment -

        Here's a patch that stops treating +, -, ! as operators if they are followed by whitespace.
        Everyone seemed to previously agree about + and -, but I also threw in ! for consistency since it was another single char (largely unknown synonym for NOT) unary operator. Thoughts?

        Show
        Yonik Seeley added a comment - Here's a patch that stops treating +, -, ! as operators if they are followed by whitespace. Everyone seemed to previously agree about + and -, but I also threw in ! for consistency since it was another single char (largely unknown synonym for NOT) unary operator. Thoughts?
        Hide
        Uwe Schindler added a comment -

        +1 !!!

        but i know lots of people that are too stupid to understand that unary operator must be directly in front of term

        Show
        Uwe Schindler added a comment - +1 !!! but i know lots of people that are too stupid to understand that unary operator must be directly in front of term
        Hide
        Jan Høydahl added a comment -

        This should be possible to backport to 3.x. I have a customer with this exact problem on 3.5...

        Show
        Jan Høydahl added a comment - This should be possible to backport to 3.x. I have a customer with this exact problem on 3.5...
        Hide
        Bill Bell added a comment -

        +1 to backport to 3x.

        Show
        Bill Bell added a comment - +1 to backport to 3x.
        Hide
        Jan Høydahl added a comment -

        Re-opening for backport

        Show
        Jan Høydahl added a comment - Re-opening for backport
        Hide
        Jan Høydahl added a comment -

        Backport to 3.6 branch. All tests pass. Committing soon.

        Show
        Jan Høydahl added a comment - Backport to 3.6 branch. All tests pass. Committing soon.
        Hide
        Jan Høydahl added a comment -

        Checked in for 3.6.1

        Show
        Jan Høydahl added a comment - Checked in for 3.6.1
        Hide
        Karsten R. added a comment -

        Should StandardQueryParser work like QueryParser?
        In current branches and trunk TestQPHelper still contains the line
        assertQueryEquals("a OR ! b", null, "a -b");
        (and also "a - b" is parsed as "a -b)

        Show
        Karsten R. added a comment - Should StandardQueryParser work like QueryParser? In current branches and trunk TestQPHelper still contains the line assertQueryEquals("a OR ! b", null, "a -b"); (and also "a - b" is parsed as "a -b)
        Hide
        Uwe Schindler added a comment -

        Bulk close for 3.6.1

        Show
        Uwe Schindler added a comment - Bulk close for 3.6.1
        Hide
        Andrew Gibb added a comment -

        This is great!

        There seems to be an inconsistency with the exclamation mark ! (NOT operator)

        "foo-" acceptable
        "foo+" acceptable
        "foo!" parse exception

        although if I add whitespace after:

        "foo! " acceptable

        Is this expected operation? Am I missing something

        Show
        Andrew Gibb added a comment - This is great! There seems to be an inconsistency with the exclamation mark ! (NOT operator) "foo-" acceptable "foo+" acceptable "foo!" parse exception although if I add whitespace after: "foo! " acceptable Is this expected operation? Am I missing something

          People

          • Assignee:
            Jan Høydahl
            Reporter:
            Yonik Seeley
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development