-
Notifications
You must be signed in to change notification settings - Fork 4
Add degraded search #107
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 degraded search #107
Conversation
Kerollmops
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if returning a tuple is the best option or if we plan to return other things and therefore returning a struct would be more future-proof? 🤔
Doing something like below is certainly "nicer", but would require also updating the api's for I kinda like how simple the methods are already, but I'm not sure if you guys have a preference at meili. @dureuill thoughts ? #[non_exhaustive]
pub struct HannoyResult {
pub neighbours: Vec<(u32, f32)>,
pub did_cancel: bool
}
pub fn by_vector_with_cancellation(
&self,
rtxn: &RoTxn,
vector: &'a [f32],
cancel_fn: impl Fn() -> bool,
) -> Result<HannoyResult> { todo!() } |
Kerollmops
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ho! Crap! I thought you were changing the output of the original search methods. Indeed doing that is great as it doesn't impact other users.
However, I was more into proposing something similar to the indexing part where we set the cancellation function with the builder and don't introduce any other API. The search methods are not returning the boolean you introduced. We can directly check if the search took too long at Meilisearch 👀
|
Hello @nnethercott , thank you for taking this one I much prefer the struct version, it is both more readable and more future-proof. I'm fine with the added methods, I don't think we'll need many much more in the future (cancellation is kind of the only support function I can think of) I'm not exactly sure if I like the Thanks again, looking forward to this ❤️ |
|
FYI @nnethercott we took the code of this PR and added it to the branch in #103 which we use in Meilisearch. |
Fixes #105
Separates layer traversal logic from
Readerto new structVisitor. Cancellation is performed by checking animpl Fn()->boolin a hot loop insideVisitor::visit. We also add 2 new methods to theReaderapi for degraded search by vector and by item.