1
votes

I am little confused how scoring is done in matchphrase and match query by seeing my results

For Match Phrase I have query like below

sd.Query(q =>    
 q.MatchPhrase(m => m  
 .Field(p => p.title)  
 .Query("Test Article in Credit")    
  ));

the reults obtained are as below
a. document with "Test Article in Credit - Consumer" score 12.64
b. document with "Test Article with Credit -X" score 12.64
c. document with "Test Article in Credit - XYZ" score 10.92
d. document with "Test Article in Credit" score 10.22
e. document with "Test Article in Credit -Z" score 09.40

first two are from different index and last three from different index

According to me the fourth one should have high score and second should have lowest. I am using standard Analyzer

Similarly my match query does same
document with title"Test" is having high score than document with title"Test Article in Credit"

I know scoring happens for more relevant articles based on frequency of term appearing , length of text.

How can i restructure my query to give documents in right order?

1
Relevancy scores are calculated per shard so can vary both within an index with more than one shard and across indices. With many documents and sensible routing however, relevancy score differences diminish across shards. A rescore query can help to smooth differences when dealing with a small number of documents.Russ Cam

1 Answers

2
votes

It's extremely hard from here to say why your expectations don't match up with the results but I will do you one better: you can find out yourself by using the Explain API