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:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user