Question about scoring


(Alexandre Heimburger) #1

Hi there,

I build an index containing documents from different types : user, space,
content etc....The type is a field of the index.

First question

Is that possible to configure to index to get a better score if a query
match an object of a given type ?

Example : if I search 'Doe' on document titles, the user 'John Doe' should
have a better score that a blog entry named 'Jonh Doe was the first man to
land on the moon'.

Second question

If the scoring 'by type' is not possible, do ES enable us to give a better
score depending on the word distribution.

Example : if I search 'Doe' on document titles, the document 'John Doe'
should be more pertinent than the document 'Jonh Doe was the first man to
land on the moon' because for the first one, the search term represents 50%
of the words.

Am I clear ?

Thanks for your help.


(lecochien) #2

Hi,
of course you are clear.
There is differents solutions to achieve what you want to do :
If you want to boost your document on certains fields you can use the
boost argument inside your term query
http://www.elasticsearch.org/guide/reference/query-dsl/term-query.html
(there is an opened issue with an exemple https://github.com/elasticsearch/elasticsearch/issues/943)
or add a little script who check fields for boosting result.
http://www.elasticsearch.org/guide/reference/query-dsl/custom-score-query.html

On 24 mai, 09:19, Alexandre Heimburger alexheimbur...@gmail.com
wrote:

Hi there,

I build an index containing documents from different types : user, space,
content etc....The type is a field of the index.

First question

Is that possible to configure to index to get a better score if a query
match an object of a given type ?

Example : if I search 'Doe' on document titles, the user 'John Doe' should
have a better score that a blog entry named 'Jonh Doe was the first man to
land on the moon'.

Second question

If the scoring 'by type' is not possible, do ES enable us to give a better
score depending on the word distribution.

Example : if I search 'Doe' on document titles, the document 'John Doe'
should be more pertinent than the document 'Jonh Doe was the first man to
land on the moon' because for the first one, the search term represents 50%
of the words.

Am I clear ?

Thanks for your help.


(Shay Banon) #3

Another option is to boost certain fields at indexing time. You can set boost in the mapping, or within the doc. See: http://www.elasticsearch.org/guide/reference/mapping/core-types.html.
On Tuesday, May 24, 2011 at 1:02 PM, lecochien wrote:

Hi,
of course you are clear.
There is differents solutions to achieve what you want to do :
If you want to boost your document on certains fields you can use the
boost argument inside your term query
http://www.elasticsearch.org/guide/reference/query-dsl/term-query.html
(there is an opened issue with an exemple https://github.com/elasticsearch/elasticsearch/issues/943)
or add a little script who check fields for boosting result.
http://www.elasticsearch.org/guide/reference/query-dsl/custom-score-query.html

On 24 mai, 09:19, Alexandre Heimburger alexheimbur...@gmail.com
wrote:

Hi there,

I build an index containing documents from different types : user, space,
content etc....The type is a field of the index.

First question

Is that possible to configure to index to get a better score if a query
match an object of a given type ?

Example : if I search 'Doe' on document titles, the user 'John Doe' should
have a better score that a blog entry named 'Jonh Doe was the first man to
land on the moon'.

Second question

If the scoring 'by type' is not possible, do ES enable us to give a better
score depending on the word distribution.

Example : if I search 'Doe' on document titles, the document 'John Doe'
should be more pertinent than the document 'Jonh Doe was the first man to
land on the moon' because for the first one, the search term represents 50%
of the words.

Am I clear ?

Thanks for your help.


(system) #4