From: Michael Peters Date: Wed, 25 May 2011 17:05:08 +0000 (-0400) Subject: use rank_cd to improve relevance ranking X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=94fefd52c4653c02cb03e6dec502ebf46d776f31;p=working%2FEvergreen.git use rank_cd to improve relevance ranking 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 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index c1fb759811..a730f16f26 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -841,7 +841,7 @@ sub tsquery { 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)'; }