Set of rules for
Lucene relevance ranking
Lucene produces a .score.
for each record, based on the following:
Scores embedded in the indexes:
- Within the title
index, query matches in the 245 $a and $b get a score of 7, while other
title fields (e.g. series title, added entry title) get a score of 1.
- In author fields,
query matches in the 100 field get a score of 4, while added entry authors
get a score of 1. Where no other author is found, the 245 $c (statement
of responsibility) is indexed and given a score of 1.5.
Scores based on which index is matched,
and how close that match is
- Every match of the
keyword as entered gets a score of 0.5, and a match of the stemmed version
of what was entered gets a match of 0.05.
- After that: scores
for matches are allocated on a base scale set below.
- titlePhrase 9
- authorPhrase 9
- subjectPhrase 9
- genrePhrase 9
- titleWords 3 (a match
from a stem gets 75% of this)
- authorWords 3
- subjectWords 3 (a
match from a stem gets 75% of this)
- genreWords 3
- titleExact 20
- authorExact 18
- These scores are
not exclusive. So if a query has a phrase match with a record, it will
also have a word match for that record, and be allocated both sets of
points.
- The phrase searches
involve a .slop factor.. This means that where those terms appear
side-by-side, in the same order as the query, the full score for a phrase
match is allocated. But where they are one or two steps apart, in either
direction, the score is discounted. After the first two rounds of testing,
we made this discounting sharper, so that that section of the score
is reduced to half as soon as another word appears between the query
terms, and decreasing slowly after that.
Other scores
- The record is allocated
a score based on the square root of the number of holdings contained
within it. This is overrun on the whole score that is allocated.
- Collection records
(where leader 7 is c) get an extra boost of 10
Lucene.s
default scoring (which we can change)
- Records where the
query term constitutes a higher proportion of the overall record are
scored higher, and query matches in short fields will score higher than
matches in long fields (unless the long fields contain more instances
of the query).
- Lucene also allocates
more weight to queries that appear rarely in the database as whole than
to queries that appear frequently. So, if you searched on Australian
aardvarks, the system would allocate a higher score to matches for aardvarks
than to matches for Australian.
- Lucene also includes
a score for records where matches occur in a wide number of fields.
How all this fits together, a
guide to users:
- Lucene doesn.t
allocate separate scores for each of these and then add them all up,
instead it uses some as a multiplication factor on others.
- To find out exactly
what is going on, type debug=y in at the end of the url after a search.
This will reveal the scoring system for the top 15 records. Then see
Kent or myself for the formulae being used behind the long system of
numbers J
- This is an excerpt
from a search for Patrick White, to give a feel, with my explanation
in blue.
58.815296 = weight(titleWords:"patrick
white"~6^9.0 in 13441535), product of:
(this means
that the phrase Patrick White must appear within six words of each other
in the title index to count as a hit. The number at the right is the
number of document the query appears in. This score is made up of two
calculated below: the queryweight, which measures the .importance.
of the hits, and the fieldweight, which measures the number of hits
- kinda)
0.30881515 = queryWeight(titleWords:"patrick white"~6^9.0),
product of:
9.0 = boost (the
boost we set for a title phrase match)
16.833977 = idf(titleWords: patrick=3222 white=28507) (this
figure is a result of a formula run on the inverse document frequency
of the query terms in the title index as a whole. The numbers in brackets
refer to the number of times that the terms appear in the title index).
0.0020383059 = queryNorm (this
is the result of a formula run measuring the idf of the query term in
the whole database. It is stable for all results in this search .
i.e. it is attached to the query, not to the record).
190.4547 = fieldWeight(titleWords:"patrick white" in 13441535),
product of:
1.4142135 = tf(phraseFreq=2.0) (The
phrase frequency here is 2 because there were two matches. The fact
that it only gets 1.4 is because the words would not have been an exact
phrase search (if so, it would have been 8 . 4x2 - so it has been
discounted according to the formula set by Kent, and then multiplied
by the number of times the phrase occurs in the field.)
16.833977 = idf(titleWords: patrick=3222 white=28507) (this
is the same as the idf above)
8.0 = fieldNorm(field=titleWords, doc=13441535) (the
field norm is calculated by a formula reflecting the inverse frequency
of term hits in the field that the hits have occurred in. The shorter
the field, the higher this score, and the number of occurrences of the
searched on terms, also the higher the hits.)
This is just one section of the
score. For all the hits in other fields, such as author, this whole
process is repeated. Then at the end, the whole score is multiplied
by a factor that represents the number of hits in the different fields
and the number of holdings.