Domanda

I am new to Elasticsearch and making search suggestion to search for videos and right now using following query (I am using Elastica Library so its just a printed array)

[query] => Array
    (
        [query_string] => Array
            (
                [query] => Mac Os
                [default_field] => title
            )

    )


[fields] => Array
    (
        [0] => title
        [1] => videoid
    )

[from] => 0
[size] => 5

This gives me some quiet relevant results "Mac OSx" "Mac OS Lion" etc.. My question is,how can i add my own scoring or rating for indexed values..e.g if someone search for "Mac OS Lion", I can increase its popularity by 1 so it should come on top the next time Or is there any better alternative?

P.S I am also new to ElasticSearch Terms and perhaps the reason i am not able find the solution the yet.

È stato utile?

Soluzione

ElasticSearch provides a variety of mechanisms to boost the score of a document or term, such as:

The general idea is that you boost a document's score depending on the value of a field or fields. In your case, you may want to have a "popularity" field that is updated and used to boost the doc's value. It depends on how you implement your code internally.

This tutorial shows how to implement "Featured Results", which is a similar concept. They used the Constant Score query.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top