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 by Last Read Items#
# Filter on last read user items with default settings
profile:{ last_read }

# Filter on last 5 read user items
profile:{ last_read count:5 }
Date Time recency Boosting#
# 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 }
Combinations of profiles#
# 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(*args, **kwds)

last_read | Boost last read items.

pydantic model PluginConfig
Fields
  • count (int)

  • last_days (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.

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.