[dokuwiki] Re: [PATCH] search problems and solutions

  • From: Matthias Grimm <matthiasgrimm@xxxxxxxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 3 Jun 2005 20:50:50 +0200

On Wed, 1 Jun 2005 20:22:56 +0200
Andreas Gohr <andi@xxxxxxxxxxxxxx> wrote:

> Hmm I like it and will probably add it, but let's think about it first
> ;-) The former method combined all word into a single regular
> expression. Your code uses a regexp for each word. So if I use three
> words I roughly triple the time used on matching. Does anyone know a way
> on combining the search words into one regexp? Maybe using assertions?

I had a deeper look iin this topic and found a better solution. I
checked what we can do with those assertions you mentioned and found a
solution. Assertions are able to handle an AND combination of search
words and more :-)

I reworked my search patch (please delete the old one) which uses
assertions. The result is that only one regular expression must be
processed instead of one for each search word. As an additional benefit
it is possible now to exclude words from the search. I implemented a
very simple search syntax:

 - A preceding minus sign (-) will exclude this word from the search results,
 - a preceding plus sign (+) will include it,
 - if neither a (+) nor a (-) is found, (+) is assumed.

I made some performance tests and measued shorter times than with the
old combining-'OR' code. The reason is that the OR code produces more
hits and hits consume most of the time. ;-) Maybe you have better profiling
capabilities.

  Best Regards
    Matthias

Other related posts: