Perlfect Solutions

[Perlfect-search] Phrasing

Daniel Naber
Sun, 20 Aug 2000 18:09:28 +0200
On Son, 20 Aug 2000, you wrote:

> include phrasing, or could give me some help in writing a patch (I'm
> still fairly new to perl too)?

I think you could do it this way: Add a new hash, that saves for every 
term/document combination the positions of the term's occurences. Position 
is relative to the other words, e.g.:
foo bar blah
foo is position1, bar is position 2, blah is position 3 etc. 

Now if someone searches for "one two" you have a match if:
pos("one") == pos("two")-1 in a document. With this algorithm you can also 
implement a NEAR operation.