Skip to content

Allow ContentBase derivatives to control how their pages are indexed by Watson#184

Merged
daniel-clayton merged 5 commits intodevelopfrom
feature/page-search-adapter
Oct 25, 2019
Merged

Allow ContentBase derivatives to control how their pages are indexed by Watson#184
daniel-clayton merged 5 commits intodevelopfrom
feature/page-search-adapter

Conversation

@lewiscollard
Copy link
Copy Markdown
Contributor

@lewiscollard lewiscollard commented Oct 16, 2019

Currently, PageSearchAdapter will examine all CharField and TextField derivatives on the page's content model to work out what should be indexed by the internal search engine. This works well, when pages are largely built out of those field types.

However, it doesn't allow searching deeper into other types of field, such as ForeignKeys. The obvious use case is our standard sections app, where all or nearly all of the page's content is built out of other models.

This changes the behaviour to add get_searchable_text to ContentBase, which is called by get_content on PageSearchAdapter. This will allow derivatives to override what text is seen by get_content.

As a bonus, this also improves the tests - it does not appear to have been testing the text field search indexing at all, because the test model had no text fields on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants