0.1.xwork withwagtail>=2.0,<2.20.2.xwork withwagtail>=2.2
pip install wagtail-whoosh
After installing this package, add wagtail_whoosh to INSTALLED_APPS. And then config WAGTAILSEARCH_BACKENDS
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail_whoosh.backend',
'PATH': str(ROOT_DIR('search_index'))
},
}Set ./manage.py update_index as cron job
results = Page1.objects.search(query).annotate_score("_score").results()
result += Page2.objects.search(query).annotate_score("_score").results()
return sorted(results, key=lambda r: r._score)
boostingis not supported.facetis not supported.autocompleteis not supported.