-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add constrains to Retrievers #212
Comments
Hi @0xadeeb, For Pre-filtering does not work for hybrid search though. In both cases, you can also consider using post-filtering, but then you're not sure you will have your 5 items. Here you need to switch to the
(I increased top_k in the search method, and constrained limited the results to 5 in the retrieval query, which is the last part of the query, to increase the chances to get exactly 5 matches, but it totally depends on your setup) |
Thanks for the response @stellasia. Is there any reason why pre filtering was not implemented for HybridSearch? If not I'm open to working on it. |
Let me explain how it works for the vector search first. Neither the vector nor the fulltext indexes allow prefiltering in Neo4j. So when using prefiltering, we are not using the index, in any case (at the time of writing). To implement prefiltering in the vector case, we leverage a function directly available in Cypher:
For the fulltext search, we do not have such a similarity function, so we can not use the same approach. |
If I'm using a retriever (eg: HybridRetriever or VectorRetriever) is it possible for me to add constrains to any of the properties.
Example:
Node: Note
Properties: user_id, content, content_embedding, last_edited
If I need to do a similarity search on the content and return the top 5 similar content but only for nodes with specific user_id. How can I do it with the above retrievers?
The text was updated successfully, but these errors were encountered: