For specific queries I want to be able to manually set the sort of some
search results. Without going into the reason why, how do I implement this?
I'm not talking about boosting, I'm talking about manually setting the sort
position based on specific query.
E.g. if users searches for "Green Military Shirts" I want to set product X
to position 1, product J to position 2. All other search results would
sorted as usual.
It appears I've answered my own question unless someone has a better
suggestion in terms of efficiency and logic. The function_score Query
(function_score Query | Elasticsearch: The Definitive Guide [master] | Elastic)
will allow for boosting specific documents based on the query. Several
different predefined methods or I can create my own custom script.
On Saturday, March 21, 2015 at 10:38:54 AM UTC-7, Zelfapp wrote:
For specific queries I want to be able to manually set the sort of some
search results. Without going into the reason why, how do I implement this?
I'm not talking about boosting, I'm talking about manually setting the sort
position based on specific query.
E.g. if users searches for "Green Military Shirts" I want to set product X
to position 1, product J to position 2. All other search results would
sorted as usual.
Easiest option, in terms of complexity, would probably be to use a bool
query, where product x and y are matched by an id query with high boosts.
Best option is probably the function score query:
Create a filter for each product and replace the score with something
arbitrarly high.
You could get detailed by using a custom script, but it will not be as
efficient.
Cheers,
Ivan
On Mar 21, 2015 7:39 PM, "Zelfapp" nate@usamm.com wrote:
For specific queries I want to be able to manually set the sort of some
search results. Without going into the reason why, how do I implement this?
I'm not talking about boosting, I'm talking about manually setting the sort
position based on specific query.
E.g. if users searches for "Green Military Shirts" I want to set product X
to position 1, product J to position 2. All other search results would
sorted as usual.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.