PDA

View Full Version : Many sites indexed - how to restrict search results to just one or two ?


ciaran@clissman
05-26-2004, 11:54 AM
Hi folks,

I've happily indexed a couple of dozen sites. Now I want to search my index, but return results from only a subset of the sites that I have indexed.

For example, I've indexed site1, site2 and site3. My user comes along and only wants search results from site2 and site3.

I'd like to implement this by calling a php script with url "blah.php?site1=0&site2=1&site3=1", and then make the appropriate calls to phpdig.

What are those calls, and are they documented ? The documentation lists the paramters for the phpdigsearch() function, but not what they are...

phpdigSearch($id_connect, $query_string, $option, $refine,
$refine_url, $lim_start, $limite, $browse,
$site, $path, $relative_script_path, 'array')

Any assistance most welcome!

Ciaran:bang:

vinyl-junkie
05-26-2004, 06:02 PM
This thread (http://www.phpdig.net/showthread.php?s=&threadid=363&highlight=directory) might be useful. You can skip the first part of it, as it's just telling you how to restrict spidering to a specific directory, which it sounds like you've already done. The sample html is what you want to look at.

Hope it helps. :)

ciaran@clissman
05-27-2004, 02:11 AM
Thanks Pat !

In the meantime I have worked out the following, which is a slightly different approach to using the same variables.

1 : To focus your search on a single site. click the 'refine' line in a search result for that site, on the sitename. This then shows only the search results for that particular site. The interesting part is the site number ('site=' in the url).

2 : To focus the search on an area within a site, click the 'path' part of the refine line. This then shows only the results for that particular path (or directory). the 'path=' part of the url tells you how to express the path in a manner that phpdig will understand.

3 : You can then construct a URL to make phpdig carry out a search just on the one site, without too much trouble. Here's a sample line from my script

$weburl="http://hostname.ie/phpdig/search.php?refine=1&query_string=".$query."&site=15&limite=10&option=start";

where I pass a query from a search form to phpdig and tell it only to search site 15 on my index.

I haven't worked out how to tell phpdig to search multiple sites (e.g. to search sites 1, 2 and not 3 or 4) and I suspect that some extra code would be needed, including new parameters to the phpdigsearch() function.

I hope this is useful to someone.

In the meantime, thanks again to Pat.

Ciaran