Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QueryWithNegative allows you to pass a string that will be excluded from the search results. There are tree ways to implement this: 1. Find the document matching the normal query. Then re-order the result by multiplying the similarity by the dot product with the negative vector and some constant. 2. Find the document matching the normal query. Exclude documents where the dot product with the negative vector are above a constant. 3. The simpler method I implemented which just subtracts the negative vector from the positive one and re-normalizes the result. I have done some simple tests and the results look good. I'm not sure if the extra function is a nice API. It could also be added as extra argument to Query. Or maybe Query should get a struct for it's argument as the number of arguments seems to keep increasing.
- Loading branch information