BLI: use float instead of int for weights in string search

Floats are a bit more convenient to deal with. Also, I find myself
expecting this to be a float on the call site.
This commit is contained in:
Jacques Lucke
2024-04-12 14:34:17 +02:00
parent a4de136e78
commit 769a9069de
2 changed files with 3 additions and 3 deletions

View File

@@ -28,7 +28,7 @@ struct SearchItem {
int main_group_id;
int main_group_length;
int total_length;
int weight;
float weight;
/**
* This is a logical time stamp, i.e. the greater it is, the more recent the item was used. The
* number is not based on an actual clock.
@@ -70,7 +70,7 @@ class StringSearchBase {
MainWordsHeuristic main_words_heuristic_;
protected:
void add_impl(StringRef str, void *user_data, int weight);
void add_impl(StringRef str, void *user_data, float weight);
Vector<void *> query_impl(StringRef query) const;
};

View File

@@ -479,7 +479,7 @@ void extract_normalized_words(StringRef str,
}
}
void StringSearchBase::add_impl(const StringRef str, void *user_data, const int weight)
void StringSearchBase::add_impl(const StringRef str, void *user_data, const float weight)
{
Vector<StringRef, 64> words;
Vector<int, 64> word_group_ids;