Extension Search Enhancements


Extension Basics

Title
Search Enhancements
Name
ckanext-search-tweaks
Type
Public extension
Description
Set of tools for controlling search results and sorting
CKAN versions
Download-Url (zip)
Download-Url commit date
2023-11-04
Url to repo
Category
Data Management & Quality


Background Infos

Description (long)
Show details

Set of tools providing comprehensive control over CKAN search results, sorting, and relevance. Consists of multiple plugins: search_tweaks (base, enables edismax query parser and ISearchTweaks interface), search_tweaks_query_relevance (promotes datasets visited frequently after specific searches using Redis-based statistics), search_tweaks_field_relevance (boosts datasets based on numeric field values via Solr boost functions), and search_tweaks_spellcheck (provides ‘Did you mean?’ suggestions using Solr spellcheck component). Features include fuzzy search with configurable edit distance, custom qf parameters, MinimumShouldMatch configuration, boost vs bf preference, and extensive CLI commands for managing statistics and spellcheck dictionaries.

Version
0.6.0
Version release date
2023-11-04
Contact name
DataShades
Contakt email
(not set)
Contact Url
(not set)


Installation Guide

Configuration hints

Installation:

1. Install the extension:

pip install ckanext-search-tweaks

2. Add plugins to ckan.plugins (at least search_tweaks required):

ckan.plugins = … search_tweaks [search_tweaks_query_relevance] [search_tweaks_field_relevance] [search_tweaks_spellcheck]

#

Plugin Descriptions:

- search_tweaks: Base plugin (required), switches to edismax, provides ISearchTweaks interface

- search_tweaks_query_relevance: Promotes datasets by visit frequency (requires Redis)

- search_tweaks_field_relevance: Boosts by numeric field value via Solr functions

- search_tweaks_spellcheck: ‘Did you mean?’ feature (requires Solr config changes)

#

Common Configuration (search_tweaks):

ckanext.search_tweaks.common.qf - Rewrite qf parameter (default: QUERY_FIELDS)

ckanext.search_tweaks.common.fuzzy_search.enabled - Enable fuzzy search (default: false)

ckanext.search_tweaks.common.fuzzy_search.distance - Max misspelled letters 1-2 (default: 1)

ckanext.search_tweaks.common.fuzzy_search.keep_original - Keep original in fuzzy (default: true)

ckanext.search_tweaks.common.prefer_boost - Use boost over bf with edismax (default: true)

ckanext.search_tweaks.common.mm - MinimumShouldMatch (default: 1)

#

Query Relevance Configuration:

ckanext.search_tweaks.query_relevance.min_boost - Minimum boost (default: 1)

ckanext.search_tweaks.query_relevance.max_boost - Maximum boost (default: 1.5)

ckanext.search_tweaks.query_relevance.max_boost_count - Max boosted datasets (default: 60)

#

Field Relevance Configuration:

ckanext.search_tweaks.field_relevance.boost_function - Solr boost function (e.g. pow(promoted_level,2))

ckanext.search_tweaks.field_relevance.blueprint.promotion.field_name - Promotion field name (default: promotion_level)

ckanext.search_tweaks.field_relevance.blueprint.promotion.enabled - Enable promotion route (default: False)

#

Spellcheck Configuration:

ckanext.search_tweaks.spellcheck.more_results_only - Only suggest if more results (default: true)

ckanext.search_tweaks.spellcheck.max_suggestions - Max suggestions count (default: 1)

#

CLI Commands:

ckan search-tweaks relevance query export/import/reset

ckan search-tweaks spellcheck rebuild

#

Spellcheck Solr Setup (solrconfig.xml):

Add to searchComponent:

did_you_mean

did_you_mean

false

Add to search handler:

spellcheck

Define schema field and copyFields from title, notes, res_name, etc.

Plugins to configure (ckan.ini)
search_tweaks
CKAN Settings (ckan.ini)
# ckanext.search_tweaks.common.qf = title^5 text # ckanext.search_tweaks.common.fuzzy_search.enabled = false # ckanext.search_tweaks.common.fuzzy_search.distance = 1 # ckanext.search_tweaks.common.fuzzy_search.keep_original = true # ckanext.search_tweaks.common.prefer_boost = true # ckanext.search_tweaks.common.mm = 1 # ckanext.search_tweaks.query_relevance.min_boost = 1 # ckanext.search_tweaks.query_relevance.max_boost = 1.5 # ckanext.search_tweaks.query_relevance.max_boost_count = 60 # ckanext.search_tweaks.field_relevance.boost_function = pow(promoted_level,2) # ckanext.search_tweaks.field_relevance.blueprint.promotion.field_name = promotion_level # ckanext.search_tweaks.field_relevance.blueprint.promotion.enabled = false # ckanext.search_tweaks.spellcheck.more_results_only = true # ckanext.search_tweaks.spellcheck.max_suggestions = 1
DB migration to be executed
(not set)
<< back to Extensions