Currently the keywords applies its logic thanks to a broad doApply method.
It currently populates a bunch of states in the SearchContext.
We should introduce different interfaces that fit keywords needs. So far we identified these needs:
- HighlightingKeyword: pass the HighlightBuilder so that keywords can change the highlighting behavior
- RescoringKeyword: pass a RescoreBuilder to affect the rescore window components
- FilteringKeyword: so that they can inject their filters
- ScoringKeyword (better name needed): so that they can affect the main query scores (e.g. intitle)
- InitialSearchContextKeyword: so that they can affect the InitialSearchContext (setting the namespaces or limiting search to local results)
- LegacyKeyword: will have the old doApply method so that we can still support them while we migrate to dedicated interfaces
Keywords will be able to implement multiple interface:
- prefix will implement InitialSearchContextKeyword and FilteringKeyword
- intitle will implement FilteringKeyword and ScoringKeyword
- subpageof/insource/intitle will implement FilteringKeyword and HighlightingKeyword