Modify

Opened 10 years ago

#5650 new defect

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

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.

Attachments (0)

Change History (0)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to adjuva@gmx.de
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.