|
Blender V4.3
|
#include <BLI_string_search.hh>
Inherits blender::string_search::StringSearchBase.
Inherited by blender::ui::string_search::StringSearch< T >.
Public Member Functions | |
| StringSearch (const RecentCache *recent_cache, const MainWordsHeuristic main_words_heuristic) | |
| void | add (const StringRef str, T *user_data, const int weight=0) |
| Vector< T * > | query (const StringRef query) const |
StringSearch filters and sorts search items based on a string query. Every search item has data of type T attached that is used to identify it.
When querying, the a match score is computed between the query string and each item. Items that don't match are filtered out, the rest is sorted by the score. Elements with the same score are further sorted based on the optionally provided weight and other heuristics.
The usage is simple. First add all the search items and then use the query method.
Definition at line 87 of file BLI_string_search.hh.
|
inline |
Definition at line 89 of file BLI_string_search.hh.
References blender::string_search::StringSearchBase::main_words_heuristic_, and blender::string_search::StringSearchBase::recent_cache_.
|
inline |
Add a new possible result to the search.
| weight | Can be used to customize the order when multiple items have the same match score. |
Definition at line 101 of file BLI_string_search.hh.
References blender::string_search::StringSearchBase::add_impl().
Referenced by blender::ui::attribute_search_add_items(), id_search_cb(), id_search_cb_tagged(), blender::ed::space_node::link_drag_search_update_fn(), menu_search_update_fn(), blender::ed::space_node::node_find_update_fn(), and operator_enum_search_update_fn().
|
inline |
Filter and sort all previously added search items. Returns an array containing the filtered user data.
Definition at line 110 of file BLI_string_search.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), and blender::string_search::StringSearchBase::query_impl().
Referenced by blender::ui::attribute_search_add_items(), id_search_cb(), menu_search_update_fn(), blender::ed::space_node::node_find_update_fn(), and operator_enum_search_update_fn().