Improve afterSearch
event in search service
#11882
-
Currently Move
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Just made the following changes for Craft 4.3: (d26f4ae)
|
Beta Was this translation helpful? Give feedback.
Just made the following changes for Craft 4.3: (d26f4ae)
craft\events\SearchEvent
now has a$scores
property.craft\services\Search::searchElements()
will now trigger abeforeScoreResults
event (EVENT_BEFORE_SCORE_RESULTS
), and will respect any changes made toSearchEvent::$results
. Event handlers can also setSearchEvent::$scores
from there, which will override Craft’s internal score calculations.afterSearch
event (EVENT_AFTER_SEARCH
) now passes the result scores toSearchEvent::$scores
, and any changes made to it will be returned bysearchEvent()
.