Hi,
I'm trying to order the results that I obtain throw Lucene search.
Query query = new Query(Constants.QUERY_LANG_LUCENE, sQuery);
QueryResult queryResult = repositoryService.query(store, query, false);
ResultSet results = queryResult.getResultSet();
rows = results.getRows();
Each row has a score associated that we can obtain doing this: row.getScore().
The problem is that I don't understand the puntuation of this score, or it don't works like I want. (Order by number of hits in the content of the file)
I have 4 files in Alfresco, each one with the word "hit" repeat some times. These are the files and the score that Alfresco returns me when I search the word: "hit".
- File 1.txt (one "hit" in the text) -> score = 1.0
- File 2.txt (hit hit) -> score = 0.9847
- File 3.txt (hit hit hit) -> score = 0.9824
- File 4.txt (hit hit hit hit hit hit hit hit hit hit) -> score = 0.9984
I don't understand. The max score is the file 1 with only one "hit" word in the file? And the min is the File 3 with 3 hits? And the second position is to File 4 with 10 hits in the text (this should have the max score)
What's the problem? Should I specify in the search query the order for obtain a correct score? Have you implemented something similar? To obtain a set of results order by the number of hits in the text…
Thanks!