Details
-
Bug
-
Resolution: Fixed
-
Major
-
0.3
-
None
-
Unknown
-
Description
Problem
When a search asks for only a few semantic results, the results are often not the best matching chunks of the collection: asking for more results returns better matches in the first positions than asking for few. The chat is the most affected, since its context uses 2 or 3 semantic results by default.
Steps to reproduce
- Index a collection with a few thousand chunks.
- Send POST /rest/wikis/xwiki/aiLLM/search?query=<text>&collection=<name>&limitSemanticResults=3&limitKeywordResults=0.
- Send the same request with limitSemanticResults=100.
Result
For some queries, the 3 results of the first request are not the first 3 results of the second one, and the best match of the second request can be missing from the first.
Expected
The first request returns the first 3 results of the second one.
Cause
The search of the vector index is approximate, and it explores less of the index when it is asked for fewer nearest neighbors. The semantic query asks for exactly as many neighbors as results requested.
Fix
Ask the index for at least 100 nearest neighbors and return the requested number of results.