-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't override title search boost value for elasticsearch #11929
Comments
Thanks for the report @krukas!
Can you give more details about the exact thing you're looking at here, please? If I remember correctly, the Elasticsearch backend creates separate indexes for the base Also, please can you test this against the latest Wagtail version and confirm whether the issue still exists? There were some significant changes to the boosting logic in Wagtail 6.0, and these may have already fixed this. |
@gasman I'm looking in the index settings in Elasticsearch at the All pages extends from a abstract |
I have tested with 6.0.3 and have the same results. |
Thanks for clarifying! I see what's going on here now - the indexing code is generating a mapping configuration for every subclass of Page in turn, and pushing that to the That works fine if the definitions for the core fields such as I can't see a good way to solve this - we would need to configure the index in such a way that the |
My solution would indeed not work if you have multiple boost values for the same field name. I Think the move from For us all the page title should have the same boost value, for now I use this hack/fix to change it: # In Django apps ready function
from wagtail.models import Page
Page.search_fields[0].boost = 4 # SearchField
Page.search_fields[1].boost = 4 # AutocompleteField |
Issue Summary
I have created a page model with search_fields with
SearchField
andAutoCompleteField
with different boost value. When index is created and looking at the index settings in Elasticsearch, title still uses a boost value of 2.Steps to Reproduce
Technical details
3.9.19
.4.2.11
5.2.4
Working on this
This happens because index settings are applied for every model. The order of the models applied is based on installed apps: https://github.com/wagtail/wagtail/blob/main/wagtail/search/index.py#L130. Now the last model will win and override the settings. And installed apps are mostly in order of own apps first and then the rest. Wagtail core Page model will always override the index settings.
I think to emulate how Django templates works, we can give
get_indexed_models
in reversed so that top apps are the last one to apply settings.The text was updated successfully, but these errors were encountered: