Opened 15 years ago

Last modified 4 years ago

#5650 new defect

The term 'key:' can only be the last term of a multiple AND search expression. — at Initial Version

Reported by: adjuva@… Owned by: team
Priority: minor Milestone:
Component: Core Version: latest
Keywords: search dialog Cc:

Description

In the search dialog:

The expression 'key1=* key2:' is a valid search expression and works.

When you switch the two terms surround the implicit AND you get get the logically equivalent expression 'key2: key1=*', but after pressing <enter> you got the error message 'Search expression is not valid: Unexpected token: <equals>'.

The error seems to be complex:

  • 'key2: | key1:' and 'key2:|key1:' works
  • '( key2: ) key1:' and '(key2:)key1:' works
  • 'key2: modified key1:' finds only elements, where the value of key2 contains 'modified'. It is equivalent to the expression 'key2:modified key1:'
  • 'key2: type:way key1:' is no valid expression. The error message is 'Unexpected token: <colon>'.

The whitespace after the first colon seems to be ignored. This explains all error messages and the wrong behavior in the "modified" case.

When I look in the source code, I think the error should be fixed in action/search/PushbackTokenizer.java in the Method nextToken(). After the token <colon> a token <key> with an empty string should be returned, when the colon is followed by a whitespace.

To reach this the following lines could be inserted before 'return Token.COLON;':

if (c != -1 && Character.isWhitespace(c)) {
    getChar()
    currentText = "";
    currentToken = Token.KEY;
}

This patch is not tested.

Since 'key2:' can easily be replaced by 'key2=*' or '( key2: )' this error is no blocker for complex expressions, but new user would be astonished and irritated.

Change History (0)

Note: See TracTickets for help on using tickets.