# Scoring in Exact and Phrase Matching

**URL:** <https://discuss.elastic.co/t/scoring-in-exact-and-phrase-matching/34936>\
**Category:** Elasticsearch\
**Created:** [November 18, 2015, 1:25pm UTC](https://discuss.elastic.co/t/scoring-in-exact-and-phrase-matching/34936 "2015-11-18T13:25:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JayJones](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@JayJones](https://discuss.elastic.co/u/JayJones)\
**Post date:** [November 18, 2015, 1:25pm UTC](https://discuss.elastic.co/t/scoring-in-exact-and-phrase-matching/34936/1 "2015-11-18T13:25:18Z")

</div>

Hi,

I'm fairly new to Elasticsearch and Lucene. I quickly went through the definitive guide and was able to understand how the scoring is calculated for boolean, term and multi term queries. The basic weighting is TF-IDF and scoring is based on custom VSM. Depending on query construction finalqueryscore = (booleanqueryscore + termscore1+ termscore1.....) where booleanquery, termscores are based on custom VSM.

However, I'm not very clear on what kind of scoring is used for exact and phrase matching ? For exact match, is the score always 1 ? Similar to above, is phrasequeryscore = booleanqueryscore + termscore1+ proximity(Edit Distance)..... ?

The only relevant information I found is "Individual queries may combine the TF/IDF score with other factors such as the term proximity in phrase queries, or term similarity in fuzzy queries [1]." How exactly is proximity combined ?

1. [https://www.elastic.co/guide/en/elasticsearch/guide/current/relevance-intro.html#explain](https://www.elastic.co/guide/en/elasticsearch/guide/current/relevance-intro.html#explain)

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 18, 2015, 1:50pm UTC](https://discuss.elastic.co/t/scoring-in-exact-and-phrase-matching/34936/2 "2015-11-18T13:50:34Z")

</div>

I'm not sure of a better place to look that the implementation:  
[http://grepcode.com/file/repo1.maven.org/maven2/org.apache.lucene/lucene-core/5.2.1/org/apache/lucene/search/SloppyPhraseScorer.java#71](http://grepcode.com/file/repo1.maven.org/maven2/org.apache.lucene/lucene-core/5.2.1/org/apache/lucene/search/SloppyPhraseScorer.java#71)

Meaning, I don't remember seeing a place it was better documented. You still have to jump around into things like DocScorere#computeSlopFactor to get the full picture.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:37pm UTC](https://discuss.elastic.co/t/scoring-in-exact-and-phrase-matching/34936/3 "2017-07-05T23:37:37Z")

</div>

Closed on July 5, 2017, 11:37pm UTC


