Best Bets Matching All Keywords

Post Reply
velevi
Posts: 42
Joined: Thu Sep 08, 2005 12:21 pm

Best Bets Matching All Keywords

Post by velevi »

I recently read a post that discusses exactly that topic: http://thunderstone.master.com/texis/ma ... 42cc345d10

But unfortunately, there are too few details in it. So, as the folks from the link above, we want the best bet feature to return results only when ALL words in keywords column are present in the query.

The current search script would display a best bets item if any one of the search query keywords is within the best bets keyword field, which is a problem since we want to show the best bets item only on a specific combination of keywords entered.

The messages below give the solution, but I am not familiar with the LIKEIN operator, nor with the more complicated "Metamorph Index".

How is the index created? And which part of the search script needs to change to incorporate the LIKEIN operator?

2 John 2005-05-18 11:43

In the query against the bestbet table use LIKEIN, and create a metamorph counter index on it.
-------------------

Thank you for the help!!!
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Best Bets Matching All Keywords

Post by mark »

Create index in dowalk with (right after index xmmbestbetskeywords:
create metamorph counter index xmmcbestbetskeywords
on bestbets(Keywords);

Search with (see existing search against bestbets in "getbestbet"):
select ... from bestbets where Keywords likein $sq ...;
velevi
Posts: 42
Joined: Thu Sep 08, 2005 12:21 pm

Best Bets Matching All Keywords

Post by velevi »

For some reason that doesn't work. When using the 'likein' operator it expects an array of words, rather than a string of characters? It seems like '$sq' is being assigned the value of the query? And is the query just a string or is it somehow converted to an array beforehand?

Currently with the suggestions you made last week, the Best Bets items do not yield the results expected. The pages tagged with certain keywords do not come up as a Best-Bets items neither when a visitor searches on all keywords mentioned nor on any combination of them.

What can I do further to make this work? I tried re-indexing, hoping that the 'metamorph index' that 'dowalk' creates now that I changed it, could fix things; after the re-indexing nothing really changed.

Thank you!
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Best Bets Matching All Keywords

Post by mark »

If you're doing a test search you may see something about "... would require linear search" in gray. There's one more place to put the create index statement besides the 2 places after the xmmbestbetskeywords creates. In the function "movebestbets" right before the <return "ok"> at the end add
<sql db=$dbother novars "create metamorph counter index xmmcbestbetskeywords
on bestbets(Keywords)">
</sql>
Post Reply