Scoring Plugins#
Usage via Query Syntax#
Scoring plugins are used to boost or filter documents based on specific criteria.
Each plugin is configured with a set of parameters that can be used to customize the plugin’s behavior.
Scoring plugins can be configured by search engineers or project creators, and advanced search users can call them directly within a query by using the profile:{}
literal.
Note
Installed plugins are exposed via their unique PluginConfig.plugin_name
.
Scoring plugins allow you to integrate more complex and domain-specific ranking behaviors directly into project search queries (with support from all Widgets, Dashboards and other Squirro APIs that take those Squirro queries as input).
Examples Queries#
# Filter on last read user items with default settings
profile:{ last_read }
# Filter on last 5 read user items
profile:{ last_read count:5 }
# Boost documents by their item_creation date (default date field ranking)
profile:{ recency_boost }
# Boost documents by a custom date_time label, for example `last_updated`
profile:{ recency_boost date_field:last_updated }
# Search for specific documents within users search history, and boost resulting items by their date recency
elasticsearch tutorial profile:{ last_read count:1000 } profile:{ recency_boost }
# Run concept search on a given text with additional boosting of recently trendy items
profile:{ concept text:"covid outbreak" } profile:{ popular_item last_months:1 }
# Filter documents that belong to user's subscribed communities, and boost the resulting items by their date recency
profile:{ subscribed_communities } profile:{ recency_boost }
Plugin Reference#
The plugins are categorized by their primary use-cases:
Each plugin reference contains a section called PluginConfig
, that explains all allowed parameters for plugins.
As an example, the reference for the plugin that boosts last read items looks like follows:
- class UserLastReadItem
last_read | Boost last read items.
- pydantic model PluginConfig
- Fields:
count (int)
last_days (int)
rescore_original_query_weight (float)
rescore_query_weight (float)
rescore_score_mode (Literal['total', 'multiply', 'avg', 'max', 'min'])
rescore_window_size (int)
-
PluginConfig.plugin_name:
ClassVar
[str
] = 'last_read' Used to register and reference the plugin within a query.
-
field PluginConfig.last_days:
int
= 30 Date range in days to consider user search activities.
-
field PluginConfig.count:
int
= 10 Amount of last read items to consider for boosting.
- field PluginConfig.rescore_window_size: int = 50 (alias 'window_size')
Apply the rescoring query on N top ranked items
- field PluginConfig.rescore_original_query_weight: float = 1.0 (alias 'query_weight')
The relative importance of the original query and of the rescore query can be controlled with the rescore_original_query_weight and rescore_query_weight respectively
- field PluginConfig.rescore_query_weight: float = 1.2
The relative importance of the original query and of the rescore query can be controlled with the rescore_original_query_weight and rescore_query_weight respectively
- field PluginConfig.rescore_score_mode: Literal['total', 'multiply', 'avg', 'max', 'min'] = 'multiply' (alias 'score_mode')
Controls how the scores of query & rescoring clauses are combined.
Based on the provided description, you can use the last_read
profile with last_days
and count
parameters to boost 5 documents that were read within 1 day from now.
profile:{ last_read last_days:1 count:5 }
Changelog#
Squirro Release 3.8.0: Scoring Plugin use via Query Syntax added.