I am no expert in Lucene
but I wanted to modify it in order to fulfill the requirement as:
I treat each sentence as a different document and index it in order to test the search.
For example,
Input sentences: Sam eats apples. Jeff eats oranges. Sam sam and sam eats apples and only apples. Jeff jeff and only jeff eats oranges oranges and only oranges.
Current Search
When I search for "Sam eats apples", current Lucene search scores "Sam sam and sam eats apples and only apples." the highest because it contains the terms like "sam", "eats" and "apples" more and the document appears at the top.
Modified Search(what I want)
Now, when I search for "Sam eats apples", I want the document "Sam eats apples" to score highest because it has got the exact match (along with the sequence i.e. Sam (first), eats (second) and apples (third) according to the query).
What I have thought to do: Make my custom query, weight and scoring (by extending Query, Weight and Scoring classes).
Is it feasible? and worth? OR are there any options except this?
Any suggestion would be valuable to me since I am just a beginner in Lucene
.