Forum Moderators: coopster

Message Too Old, No Replies

Related Searches Script

Related Searches Script

         

aff_dan

5:58 pm on Apr 28, 2005 (gmt 0)

10+ Year Member



Hi Sirs,

Do you know how to create Related Searches for search queries? There is any script or tutorial for it?

Any help?

Dan

mack

1:54 am on Apr 30, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Hi there,

It all depends on what language you are looking to use. From your post I asume you are using some form of search engine script on your website?

If you can provide some more details I am sure someone will be able to help you out.

Mack.

aff_dan

8:04 pm on Apr 30, 2005 (gmt 0)

10+ Year Member



Hello,

I have a xml parser with php code to retrive search results from a search engine. So I need a php code to retrive related searches for search querie. Any help?

Dan

jatar_k

9:02 pm on May 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



all depends on how you build your query I would assume, not really sure if there are any scripts out there.

anyone else have any ideas?

mack

10:37 pm on May 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I looked into this a long time back and found a few ways to do it.

One is to manualy insert similar terms into a database of some sort. That way you can use a scripting language to break your query into different words and then select from a databasse any words you have put in as similar. This could be quite resource hungry if you get a lot of queries.

Another way is to use a dictionary to make suggestins. If you are on linux you may want to look into using a script that will intercact with aspsell. Aspell has quite a few good api's

Another alternative would be to buy a ready made application to handle this for you. There are a lot of simlar apps available that may help you.

Hope this gives you some ideas.

Mack.

aff_dan

1:26 pm on May 4, 2005 (gmt 0)

10+ Year Member



Hi mack,

Please give more details information. Where I have to start...?

thanks,
dan

aff_dan

6:54 am on May 5, 2005 (gmt 0)

10+ Year Member



But,

Where I could find more, how to start?

tomda

7:25 am on May 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



GOOGLE for
"php developer's cookbook" "Creating a Search Engine"

In this book, there is a nice three-pages search engine sscript in PHP made by guys who worked at Zend (Hughes).
This is ONE book amongst many available on the net.

My 2c

aff_dan

7:33 am on May 5, 2005 (gmt 0)

10+ Year Member



Hi Tomda,

What I need is just getting Related Keywords for a search querie in my search engine... How to get this Keyword Suggestion? Any exemples? Tutorials?

tomda

7:53 am on May 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ohh! You want to know how to get related keywords to your keyword query?
OUPS, Sorry.. No tut, no example.

Like Mack suggested, I think you should go for dictionary api's query.

In my db, all keywords have parent and are grouped into categories. So, when there is a query:
1/ I use the php already-made function called "similar_text" which calculate the
similarity between two strings. This will output similar keywords.
2/ Show few keywords having the same parent ou group_id.
At least, this method give me some related search links.

aff_dan

8:00 am on May 5, 2005 (gmt 0)

10+ Year Member



Could you please help me whit that code? Could I see an exemple from you?

aff_dan

8:01 am on May 5, 2005 (gmt 0)

10+ Year Member



Could you please help me with that code? Could I see an exemple from you? Could I download it? pls..?

dan

jatar_k

4:13 pm on May 5, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



unfortunately aff_dan, there is a fair amount of logic and comparison plus the scripting of the whole thing involved in this little extra feature.

As it seems you are looking for something that is plug and play I would look at whatever site search products there are on the market. Anything you get that is open source will probably require some customization, as they all do. If you really just want something that can plug and play you may need to contract a programmer or just purchase a product.

If you want something that I have heard good things about you could try this
[google.com...]

;)

aff_dan

6:30 pm on May 5, 2005 (gmt 0)

10+ Year Member



Hi Jatar,

Will be ok an open source?
I'm looking for any information that could help me on it.

I search for it every day, 10 hours/day for 13 days looking for more information. and no results. I will try all the possibilities..

danni

jatar_k

6:54 pm on May 5, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



as opposed to just looking for a related queries add on I would look for a site search solution.

what are you using for site search right now?

aff_dan

7:07 pm on May 5, 2005 (gmt 0)

10+ Year Member



Hi Jatar,

I have a php script:

<?php
// This script transforms XML -> HTML using XSLT
// Accepts HTML form input (GET or POST) for search keywords

// Enable Globals may be turned off
$QUERY_STRING = $_SERVER['QUERY_STRING'] ;
$REQUEST_METHOD = $_SERVER['REQUEST_METHOD'] ;

// Specify URL to XML and XSL documents
$xmlDoc = 'http://xml.articletutorialsite. com';
$xslDoc = '/www/htdocs/test.xsl';

// Load "Keywords" query from form (POST or GET)
// Replace blank spaces between keywords with '+'
if ($REQUEST_METHOD=='POST') {
$data = urlencode( $_POST['Keywords'] );
} elseif ($QUERY_STRING) {
$data = urlencode( $_GET['Keywords'] );
} else {
echo "<b>Missing XML Query &#151; Use form (POST) or querystring (GET)</b>"; exit;
}
// Check for presence of NextArgs, PrevArgs and
// append to $data
if ($_GET['xargs'] ) {
$data .= "&xargs=" . $_GET['xargs'] ;
}

// Create a connection to the remote XML feed
// Read data into $xmlFeed variable
$xmlDoc .= "?Partner=affiliate_test&Keywords=$data";
$xmlConn = fopen ($xmlDoc, "r");
if (!$xmlConn) {
echo "<b>Connection to XML feed could not be established</b>"; exit;
} else {
do {
$data = fread($xmlConn,2048);
if( strlen( $data ) == 0 ) {
break;
}
$xmlFeed .= $data;
} while( true );
}
fclose($xmlConn);

// Open XSL Document
// Read data into $xslFeed variable
$xslConn = fopen ("$xslDoc", "r");
if (!$xslConn) {
echo "<b>XSL file could not be found</b>"; exit;
} else {
while ( $data= fread($xslConn,20000)) {$xslFeed .= $data;};
}
fclose($xslConn);

// Cannot pass regular variables as parameters to xslt_process() function
$arguments = array(
'/_xml' => $xmlFeed,
'/_xsl' => $xslFeed
);
// Transform XML with XSL -- return resulting HTML
$xsltproc = xslt_create();
$html = xslt_process($xsltproc, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
if (!$html) die('XSLT processing error: '.xslt_error($xsltproc));
xslt_free($xsltproc);
echo $html;
?>

This scrip I use to connect to XML, I have also in the root an test.xsl to perform the transformation in a search results like
site.com/transform.php?Keywords=anykeyword

and below this php code I will nee to add related searches for search querie.

any idea Jatar?

Danni

aff_dan

2:16 pm on May 6, 2005 (gmt 0)

10+ Year Member



anything?