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"

Andrzej Bialecki made changes - 19/Sep/08 02:38 PM
Field Original Value New Value
Attachment phraseQuery.patch [ 12390512 ]
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!

Repository Revision Date User Message
ASF #697469 Sun Sep 21 10:41:41 UTC 2008 mikemccand LUCENE-1396: improve PhraseQuery.toString: gaps are shown with a ? and multiple terms at the same position are joined with |
Files Changed
MODIFY /lucene/java/trunk/src/java/org/apache/lucene/search/PhraseQuery.java
MODIFY /lucene/java/trunk/CHANGES.txt
MODIFY /lucene/java/trunk/src/test/org/apache/lucene/search/TestPhraseQuery.java

Repository Revision Date User Message
ASF #697470 Sun Sep 21 10:42:47 UTC 2008 mikemccand LUCENE-1396: improve PhraseQuery.toString: gaps are shown with a ? and multiple terms at the same position are joined with |
Files Changed
MODIFY /lucene/java/branches/lucene_2_4/CHANGES.txt
MODIFY /lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/search/PhraseQuery.java
MODIFY /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/search/TestPhraseQuery.java

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

Michael McCandless made changes - 21/Sep/08 10:43 AM
Resolution Fixed [ 1 ]
Fix Version/s 2.9 [ 12312682 ]
Assignee Michael McCandless [ mikemccand ]
Status Open [ 1 ] Resolved [ 5 ]
Michael McCandless made changes - 11/Oct/08 12:49 PM
Status Resolved [ 5 ] Closed [ 6 ]