Daniel Naber email@example.com
Mon, 26 Aug 2002 14:29:50 +0200
On Monday 26 August 2002 07:16, James Robertson wrote:
> What we would like to do is implement a
> "synonyms list", so that if a visitor uses
> one term, it also matches documents containing
> its synonyms.
this is easy for "match any word": just replace "term1 term2"
by "term1 synonym1 term2" before the search takes place.
However, it's not so simple for "match all words". "term1 term2" would have
to be replaced by "(term1 or synonym1) and term2". This mix up between
and/or (and the parenthesis) is not supported by Perlfect Search. You'd
have to write a small parser for the user's query that builds a tree. The
leafes contain the words and the nodes contains "and" or "or". Then the
word at each leaf is searched for and set operations are used on the
results, depending on or/and.
This can be optimized by searching the "and" nodes first (I think that
makes only sense if you allow nested parenthesis).