You are here:  » External calling code - search 'keyword1 keyword2 OR keyword3 keyword4'


External calling code - search 'keyword1 keyword2 OR keyword3 keyword4'

Submitted by Stew on Mon, 2010-10-18 15:20 in

Hi there,

Apologies if this is covered elsewhere, I'm using a calling code as below:

<?php
$external_productBaseHREF 
"/product/";
$external_BaseHREF "http://www.mysite.co.uk/price/";
$external_path "/home/wwwv/public_html/price/";
$_GET["q"] = "red jumper";
if (!
$_GET["sort"]) $_GET["sort"] = "relevance";
require(
$external_path."external.php");
?>

With this code I am only getting two jumpers, so I'd like to show more results & backfill with normal jumpers so use something like:

$_GET["q"] = "red jumper,jumper";

But with this I get zero products, any ideas on the best way to go about this?

Many Thanks

Submitted by support on Mon, 2010-10-18 15:36

Hi Stew,

As your example query involves a word less than 4 characters long the basic search method will be used, which defaults to logic AND in external.php. The Full Text search, which would be invoked otherwise uses true relevancy and should return all products with red or jumper.

The basic search method can be modified to use logic OR. In your external.php, look for the following code around line 476:

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

...and REPLACE with:

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

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Stew on Tue, 2010-10-19 12:51

Hi David,

Many thanks for that, I have another query, is the following possible somehow:

$_GET["q"] = "black jumper,green jumper";

Where the results would show black jumpers OR green jumpers?

Many Thanks

Stew

Submitted by support on Tue, 2010-10-19 15:22

Hi Stew,

Yes - that can be done but the changes are a bit more involved - probably easiest if you could email me your current external.php and I'll work it out for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by richard on Thu, 2014-05-22 22:15

Hi David

I hope you are well.

I have just noticed that I have an issue with search results with searchExternal.php

For example, product name is "Mothercare Blue Canvas Shoes".

If I search for "Blue Canvas Shoes" then all is good and I get the expected result.

However, if I search for "Blue Shoes" I get nil results. What do I need to do to make search more effective?

Regards

Richard

Submitted by support on Fri, 2014-05-23 10:12

Hi Richard,

I know you've been using the script for several years and I've helped many users with various versions of searchExternal.php - just so I can see the code in use, please could you email me your latest version, and I'll check it out and see what to suggest...

Cheers,
David.
--
PriceTapestry.com

Submitted by richard on Fri, 2014-05-23 11:49

Hi David

Many thanks, email sent.

Regards

Richard