Hero Zzyzzx has asked for the wisdom of the Perl Monks concerning the following question:
I believe I have aged a few years trying to figure out the best way to do this.
For various reasons, I'm reduced to writing my own site search engine.
I've already made a stab at an indexer, and I'm happy with the results.
The thing that's bugging me is how to create a search query parser that allows for parenthesis, "and", "or", and "not" matching. After reading the Cookbook and this article on perl.com, I have some ideas but I'm losing it on the implementation.
Here's what I want to do:
The thing that's mostly eluding me is step 3- how to send everything from "(" to ")" somewhere.
The code I'm using to walk through the string word-by-word is:
And this works pretty well. Any help is appreciated, especially if you know some CPAN modules that would simplify this. I've played with Text::Balanced and it's partially what I need.foreach($query =~ /\b([A-Za-z'\d.@\/:-]+)\b/g){ #do stuff here }
-Any sufficiently advanced technology is
indistinguishable from doubletalk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Search engine query parsing
by perrin (Chancellor) on Aug 16, 2001 at 02:38 UTC | |
by Hero Zzyzzx (Curate) on Aug 16, 2001 at 07:36 UTC | |
by perrin (Chancellor) on Aug 16, 2001 at 07:49 UTC |