Dente has asked for the wisdom of the Perl Monks concerning the following question:
I need to know if there is a efficient way to differentiate keyword search results between 2 flatdbs. I have been blessed to have jarich help split filehandles and assign them to arrays to hold data until needed later. However, earlier on I find I need to differentiate search results.
These are my placeholders
I need to differentiate between ~ s/%%keywords%%/$fields{'keywords'}/g; for the %%searcresult%% and %%premiumlistings%%$main_template =~ s/%%keywords%%/$fields{'keywords'}/g; $main_template =~ s/%%searcresults%%/$pitem/g; $main_template =~ s/%%keywords%%/$fields{'keywords'}/g; $main_template =~ s/%%premiumlistings%%/$premiumitem/g;
$fields{'keywords'} = &get_search_ready($fields{'keywords'}); if ($fields{'keywords'} eq ""){$fields{'keywords'} = "NOTHING";} if (length($fields{'keywords'}) < $minimum_keyword_length){$fields{'ke +ywords'} = "2_CHARS";} if (($use_mysql eq "Yes") and ($fields{'keywords'} ne "NOTHING") and ( +$fields{'keywords'} ne "2_CHARS")) { &mysql_search; } elsif (($fields{'keywords'} ne "NOTHING") and ($fields{'keywords'} + ne "2_CHARS")) { &normal_search; } if (($fields{'keywords'} eq "NOTHING") or ($fields{'keywords'} eq "2_C +HARS")) { $fields{'keywords'} = ""; } #### RELEVANCE $rspcntr = 0; ############ CAPTURES ALL KEYWORD INPUT ############### (@skeyw) = split(/ /,$fields{'keywords'}); ########### ADDED 04/29/04 ################### $nrkeywords = push(@skeyw); foreach $kwrel (@resultline) ########################################### { $keycount = 0; $kwcntr = 1000; while ($keycount < $nrkeywords) { #### TITLE (@litems) = split(/\t/,$kwrel); if ($litems[1] =~ /$skeyw[$keycount]/i) { $kwcntr = $kwcntr - 5; } #### DESCRIPTION if ($litems[2] =~ /$skeyw[$keycount]/i) { $kwcntr = $kwcntr - 1; } #### KEYWORDS if ($litems[5] =~ /$skeyw[$keycount]/i) { $kwcntr = $kwcntr - 4; } ##### GENERAL if (($kwrel =~ /$skeyw[$keycount]/i) and ($skeyw[$keycount] +ne "")) { $kwcntr = $kwcntr - 1; } ##### PHRASE if (($kwrel =~ /$fields{'keywords'}/i) and ($nrkeywords > 1) +) { $kwcntr = $kwcntr - 10; } ##### AND BOOLEAN MATCHING if ($nrkeywords == 2) { if (($kwrel =~ /$skeyw[0]/i) and ($kwrel =~ /$skeyw[1] +/i)) {$kwcntr = $kwcntr - 20;} } elsif ($nrkeywords == 3) { if (($kwrel =~ /$skeyw[0]/i) and ($kwrel =~ /$skeyw[1] +/i) and ($kwrel =~ /$skeyw[2]/i)) {$kwcntr = $kwcntr - 30;} } elsif ($nrkeywords == 4) { if (($kwrel =~ /$skeyw[0]/i) and ($kwrel =~ /$skeyw[1] +/i) and ($kwrel =~ /$skeyw[2]/i) and ($kwrel =~ /$skeyw[3]/i)) {$kwcntr = $kwcntr - 40;} } $keycount++; } if (length($kwcntr) == 3){$kwcntr = "0" . $kwcntr;} if (length($kwcntr) == 2){$kwcntr = "00" . $kwcntr;} if (length($kwcntr) == 1){$kwcntr = "000" . $kwcntr;} $resultline[$rspcntr] = $kwcntr . "-_:" . $kwrel;
If not, is there a way to add multiple names (inferences) to the search input text field so I may separate 'keywords' from 'keywords2' to differentiate the %%searchresults%% placeholder from the %%premiumlistings%% placeholder doring the same search process?
Example: http://www.urhosted.com/mall/searchres.html - template before populated
then search for "store"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Separating multiple keyword search input
by tkil (Monk) on Apr 30, 2004 at 05:50 UTC | |
by Dente (Acolyte) on May 03, 2004 at 23:44 UTC | |
by tkil (Monk) on May 13, 2004 at 07:10 UTC | |
|
Re: Separating multiple keyword search input
by davido (Cardinal) on Apr 30, 2004 at 03:00 UTC | |
|
Re: Separating multiple keyword search input
by bart (Canon) on Apr 30, 2004 at 19:33 UTC |