I use WhitespaceAnalyzer as a query analyzer. If I have 2 documents:
| text | abc | | text | bac |
text is a field.
Now the index structure looks something like this:
|Term| in document | | a | abc / bac| | b | abc / bac| | c | abc / bac|
And I have a request:
| text | abc |
How can I get a higher score for abc and lower for bac .
Does Lucene support the calculation of scores based on relative position ?
I found that I found this to help:
PhraseQuery phraseQuery = new PhraseQuery(); phraseQuery.setSlop(1);
Thus, they will receive different grades.
More details: http://www.blogjava.net/tangzurui/archive/2008/09/22/230357.html
And here I come across another question: stack overflow
source share