Merged
Conversation
generall
commented
Aug 13, 2025
Comment on lines
+111
to
+128
| let lowercase = lowercase.unwrap_or(true); | ||
|
|
||
| let language = language.unwrap_or_else(|| DEFAULT_LANGUAGE.to_string()); | ||
|
|
||
| let stemmer = match stemmer { | ||
| None => Stemmer::try_default_from_language(&language), | ||
| Some(stemmer_algorithm) => Some(Stemmer::from_algorithm(&stemmer_algorithm)), | ||
| }; | ||
|
|
||
| let stopwords_config = match stopwords { | ||
| None => { | ||
| // Try to create from the language | ||
| Language::from_str(&language) | ||
| .ok() | ||
| .map(StopwordsInterface::Language) | ||
| } | ||
| Some(stopwords_interface) => Some(stopwords_interface), | ||
| }; |
generall
commented
Aug 13, 2025
| fn hash<H: Hasher>(&self, state: &mut H) { | ||
| let options = match self { | ||
| DocumentOptions::Common(options) => Cow::Borrowed(options), | ||
| DocumentOptions::Bm25(bm25) => Cow::Owned(bm25.to_options()), |
Member
Author
There was a problem hiding this comment.
Don't expect Bm25 branch to ever be used, as we don't deserialize into Bm25
This comment was marked as resolved.
This comment was marked as resolved.
| }; | ||
|
|
||
| // Order of keys in the map should not affect the hash | ||
| let mut keys: Vec<_> = options.keys().collect(); |
Contributor
There was a problem hiding this comment.
Can we maybe just collect the options into a BTreeMap instead? I think this custom hashing approach might cause hard to detect bugs in future.
Alternatively we could just replace the initial HashMap with a BTreeMap, the APIs should be the same.
Member
There was a problem hiding this comment.
How about this?
// Order of keys in the map should not affect the hash
let mut keys: Vec<(_, _)> = options.iter().collect();
keys.sort_by_key(|(key, _)| *key);
keys.hash(state);I'm not too worried about it because it does not have to be portable.
Member
There was a problem hiding this comment.
I'll merge this now so I can roll the release. We can handle this one separately if we like.
timvisee
approved these changes
Aug 14, 2025
timvisee
pushed a commit
that referenced
this pull request
Aug 14, 2025
* make bm25 parameters compatible with default fastembed params * bm25 params in openapi schema * fmt * improve bm25 config deserialization * more explicit docstring for disabling english
Merged
Merged
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
languageparam, which is used to create default stopwords and stemmer