With the changes made to query parsing and searching in rel_2_0,
the relevance adjustment bumps specified in the search.relevance_adjustment
table can degrade search performance. Removing all of the rows from
search.relevance_adjustment can improve search speed, but at the
cost of making relevance ranking problematic for some searches (e.g., as of
the date of this patch, doing a title search on "the help").
This patch implements a subset of the cover density ranking being introduced
in 2.1, specifically the following normalization options to rank_cd:
2 divides the rank by the document length
4 divides the rank by the mean harmonic distance between extents (this is implemented only by ts_rank_cd)
8 divides the rank by the number of unique words in document
Original commit description from Mike Peters:
Patch to QueryParser.pm to fix search results sort order by rjackson courtesy of Steve Callender
[courtesy of Mike Rylander --gmc]
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
sub rank {
my $self = shift;
return $self->{rank} if ($self->{rank});
- return $self->{rank} = 'rank(' . $self->table_alias . '.index_vector, ' . $self->table_alias . '.tsq)';
+ return $self->{rank} = 'rank_cd(' . $self->table_alias . '.index_vector, ' . $self->table_alias . '.tsq,14)';
}