larsen has asked for the wisdom of the Perl Monks concerning the following question:
It works just fine, thanks to hash tables. Now I'd like to allow users to write only pieces of words to perform the search (e.g.: "man" will match "man" and "maniac"). In this case, I'd have to modify the code. Something like:$id = $Words_db{$word}; foreach $i (keys %Index_db) { if ($i == $id) { @fileId = split( /:/, $Index_db{$i}); foreach $fId (@fileId) { # ... } } }
I didn't try that, because it seems to be too inefficient. I'd be glad to see your suggestion. Thank you. Larsenmy $piece; foreach (keys %Words_db) { if ( ... ) { # if $piece is a substring of $_ ... } else { $piece does not occur in $_ ... } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Search engine
by davorg (Chancellor) on Aug 01, 2000 at 16:39 UTC | |
|
RE: Search engine
by nuance (Hermit) on Aug 01, 2000 at 17:02 UTC | |
by larsen (Parson) on Aug 01, 2000 at 17:41 UTC | |
by nuance (Hermit) on Aug 01, 2000 at 17:45 UTC | |
|
Re: Search engine
by maverick (Curate) on Aug 01, 2000 at 19:13 UTC | |
|
Re: Search engine
by lhoward (Vicar) on Aug 01, 2000 at 16:52 UTC |