Issue Details (XML | Word | Printable)

Key: LUCENE-1396
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Michael McCandless
Reporter: Andrzej Bialecki
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Lucene - Java

Improve PhraseQuery.toString()

Created: 19/Sep/08 02:33 PM   Updated: 11/Oct/08 12:49 PM
Return to search
Component/s: Search
Affects Version/s: 2.4, 2.9
Fix Version/s: 2.4, 2.9

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works phraseQuery.patch 2008-09-19 02:38 PM Andrzej Bialecki 3 kB

Lucene Fields: New
Resolution Date: 21/Sep/08 10:43 AM


 Description  « Hide
PhraseQuery.toString() is overly simplistic, in that it doesn't correctly show phrases with gaps or overlapping terms. This may be misleading when presenting phrase queries built using complex analyzers and filters.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Andrzej Bialecki added a comment - 19/Sep/08 02:38 PM
This patch improves toString(), and adds a unit test.

Gaps are represented as "?" and overlapping terms are separated by a vertial bar sign. Example:

  • Query string:
    "hi this is a test"
  • Parsed using StopFilter:
    "hi ? ? ? test"
  • Added term "hello" at position 1:
    "hi hello ? ? test"
  • Added term "hello" at position 0:
    "hi|hello ? ? ? test"

Michael McCandless added a comment - 20/Sep/08 09:02 AM
I think this is a good improvement and the patch is minor. I plan to commit to 2.4 & 2.9. Thanks Andrzej!

Michael McCandless added a comment - 21/Sep/08 10:43 AM
Committed revision 697469 (trunk) and 697470 (2.4). Thanks Andrzej!