Skip to main content.
home | support | download

Back to List Archive

Re: Query parsing

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Tue Mar 02 2004 - 15:05:51 GMT
On Mon, Mar 01, 2004 at 09:27:07PM -0800, Dave Moreau wrote:

> > > meta1=(foo meta2=bar blah) --> meta1=foo meta2=bar swishdefault=blah

> It seems to me like 'blah' should be in meta1 in the query, but it is 
> probably silly to discuss because anyone using such a query deserves to get 
> wrong results!

This is a big topic.  I stuggled for a day trying to rewirte the query 
parser.  It is indeed broken in a few ways.  One way is as you note 
above.  Swish-e just parsers the query left to right so there's no 
nesting of metanames.  So the above results in blah in swishdefault.

The parser in the highlighting code is a recursive parser and likely
works better at parsing the query, but may not match what swish-e is
doing -- note that it's placing blah where it should be placed:

$ perl -MSWISH::ParseQuery -MData::Dumper -le 'print Dumper parse_query("meta1 = ( foo meta2 = bar blah )")'
$VAR1 = {
          'meta1' => [
                       [
                         'foo'
                       ],
                       [
                         'blah'
                       ]
                     ],
          'meta2' => [
                       [
                         'bar'
                       ]
                     ]
        };

> I only asked cuz i'm working on my own PHP highlighting. I'll follow the 
> swish-e parsing there instead of the CGI.

Well, the plan is to fix the swish-e parser so I'd actually follow the 
ParserQuery method.

I'm still wishing for someone to come along and help me with the parser 
code.


-- 
Bill Moseley
moseley@hank.org
Received on Tue Mar 2 07:06:07 2004