You are here:  » Display Exact Search Query in searchExternal

Support Forum



Display Exact Search Query in searchExternal

Submitted by npaitken on Tue, 2010-02-23 17:41 in

Hi David,

I'd like to be able to exercise more control over display results using searchExternal.

More specifically, a good while ago I created a file searchExternal_single.php (and also searchresults_external_single.php) which returns only 1 result. This is great for doing single product reviews. But it can be a bit of a hit or miss with shortish searchs of say 3/4 words.

An actual example is:

$_GET["q"] = "Cobra S9 Irons";

returns
2nd Hand Cobra S9 08 Irons 5 SW Steel

rather than
Cobra S9 Irons

Is there anyway to force Price Tapestry (just searchExternal_single) to return only the exact search?

Hope this is possible.

Best
Neil

Submitted by support on Wed, 2010-02-24 09:31

Hi Neil,

Sure - in your searchExternal_single.php; first look for the following code (around line 123)

        if ($useFullText)

...and REPLACE that with:

        if (FALSE)

Then look for the following code around line 140:

          $where = implode(" AND ",$wheres);

...and REPLACE with:

          $where = "name = '".database_safe($q)."'";

That should make it single result, exact match only!

Cheers,
David.

Submitted by npaitken on Wed, 2010-02-24 09:59

Thanks David.