Gossamer Forum
Home : Products : Links 2.0 : Customization :

Weight Search Results

Quote Reply
Weight Search Results
I want to make search results more relevant by weighting fields so that an occurrence of the search term in the title field of a link will be listed before the occurrence of the search term in the description field of a link.
I saw this done in Fluid Dynamics Intermediate Search but not sure how to implement this in Links.

The Intermediate Search script sets
Options for Weighted Search: (name_x, $title_x, $keywords_x, $description_x) = (2,4,2,2);
where (2,2,4,2) are multipliers to weight the fields.

Then later in the script in sub search there is
# Extract the title, if there is one:
if ($string =~ /<title>(.*)<\/title>/i)
{
$titles{$FILE} = $1;
for ($i=1;$i<$title_x;$i++)
$string .= $titles{$FILE};
{
}
}
$titles{$FILE} = $FILE unless $titles{$FILE};

and so on for the other fields.

I would appreciate any comments on how to modify this to use with Links search.cgi