Forum Moderators: coopster
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.
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.
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...]
;)
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 — 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