parisholley / wordpress-fantastic-elasticsearch

Improve wordpress search performance/accuracy and enable faceted search by leveraging an ElasticSearch server.
MIT License
162 stars 64 forks source link

Move addSort so it is possible to override sort value in elasticsearch_searcher_query filter #69

Closed montepente closed 10 years ago

montepente commented 10 years ago

Move addSort so it is possible to override sort value in elasticsearch_searcher_query filter

Right now, it is impossible to sort by "_score" ascending instead of descending because the value is overriden after the searcher_query filter. By moving the addSort just before the filter, it is possible to do so.

parisholley commented 10 years ago

this was addressed in 2.2 (it checks to see if sort is set before adding a default), i think a problem with this change is it will actually stack the sorts vs. overwrite (i haven't tested this out but it seems implied by the fact it is called "addSort").

montepente commented 10 years ago

If it's under, it will stack with the ones we set before, yes but for example, if we have a sort ("_score" => "asc"), it will add ("_score") right after. So the way it is right now, it is never possible to set an ascending score