It seems when I do a search such as "covered wagon" ~5 or the like,
the systems disregards the order of my terms. I.E., it will find covered
within 5 of wagon and it will also find wagon within 5 of covered.
I wanted to see this in action myself, so I coded up a small unit test:
public void testOrderDoesntMatter() throws Exception {
Directory directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
Document doc = new Document();
doc.add(Field.Text("field", "one two"));
writer.addDocument(doc);
writer.optimize();
writer.close();
IndexSearcher searcher = new IndexSearcher(directory);
PhraseQuery query = new PhraseQuery();
query.setSlop(5);
query.add(new Term("field", "two"));
query.add(new Term("field", "one"));
Hits hits = searcher.search(query);
assertEquals(1, hits.length());
searcher.close();
}Notice that I'm searching for "two one"~5 (yet indexed "one two") and it found 1 hit.
Is there anyway to make the system respond only to the order of the terms as entered in the query?
Joe Paulsen
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
