On Thu, Jul 15, 2004 at 03:23:18AM -0700, Jonas Wolf wrote:
> Ok, I realise this was my mistake. SWISH::PhraseHighlight of course
> requires SWISH::Stemmer to look up the stemmed word for every "real" word
> in the text. Since SWISH::Stemmer is quite old and the SWISH::API access
> to the stemming functions has changed, I altered SWISH::PhraseHighlight to
> cope with this. Now it is passed a stemming function in the constructor
> which is then used for stemming, if necessary. Here is the code, if anyone
> is interested.
I updated search.cgi and PhraseHighlight.pm to work with the stemmer
in SWISH::API as you suggested, but I had to accomplish it in a
slightly different way because the version of search.cgi in cvs has
changed from the version you were working with.
Specifically, I couldn't pass in the stemmer function on calling
SWISH::PhraseHighlight->new() because that happens before there's any
results in the current version. That also has the very slight chance
of breaking if in the future we are searching different indexes at the
same time. So instead I pass the result object in each call to
highlight() -- then highlight() can determine if stemming was applied
and use the result->FuzzyWord() method to stem the word.
That requires a change in the tempalte, though. So instead of
displaying a property like:
[% item.Property('swishtitle') | highlight('swishtitle' ) %]
you would use:
[% item.Property('swishtitle') | highlight('swishtitle', item ) %]
(where "item" happens to be the result object). That's not required,
but if "item" is supplied then highlight() will check for fuzzy
indexing and use that object for stemming text.
Thanks for help with this.
Unsubscribe from or help with the swish-e list:
Help with Swish-e:
Received on Wed Jul 21 14:01:53 2004