I think Soshite is asking if it’s possible to have radio buttons to restrict where the search applies ... like only search blogs, or an image gallery, or site content.
The format of &filter in version AS 1.8 is not very well adapted to be use with radio button or multiple-list form.
Following your request, I plan with the next release 1.8.1 to add a general parameter named "whichSearch" to manage this kind of stuff.
&whichSearch=`keyword` where keyword is a token defined by the programmer to do a link with a full AjaxSearch call snippet already defined in the configuration file.
e.g: &whichSearch=`travels` with in the configuration file a use function to define the relationship with the appropriate AS search.
For instance we could imagine the following AS search orders defined in the configuration file:
function whichSearch($req){
$searchParameters = array();
switch($req){
case "blog": // limited to blog documents
$searchParameters["parent"] = "124" // excludes all documents which haven't id 124 as ancestor (blog id root)
break;
case "travels": // subset of the blog - articles regarding travels
$searchParameters["parent"] = "124" // excludes all documents which haven't id 124 as ancestor (blog id root)
$searchParameters["filter"] = "tv_content,7,travels"; // excludes all the document which haven't a TV value equal to "travels"
break;
case "image gallery": // limited to image galleries
$searchParameters["parent"] = "300"; // excludes all documents which haven't id 300 as ancestor (image gallery id root)
break;
case "china gallery": // limited to image galleries relating to china
$searchParameters["parent"] = "300"; // excludes all documents which haven't id 300 as ancestor (image gallery id root)
$searchParameters["filter"] = "tv_content,7,china"; // excludes all the document which haven't a TV value equal to "china"
break;
case "comments"
$searchParameters["parent"] = "124" // excludes all documents which haven't id 124 as ancestor (blog id root)
$searchParameters["whereSearch"] = "content,jot"; // do the search in the jot elements, not only in documents
break;
case "blog2": // limited to blog documents - different presentation
$searchParameters["parent"] = "124" // excludes all documents which haven't id 124 as ancestor (blog id root)
$searchParameters["extract"] = "5:introtext,content,tv_content" // uses these elements to set up a maximum of 5 extracts per search results
break;
case "products": // search in the custom tables
$searchParameters["whereSearch"] = "product,shop" // search in product and shop customs tables (defined in config file)
$searchParameters["extract"] = "name,shop_name,shop_address"; // uses these elements to set up a maximum of 5 extracts per search results
break;
}
return $searchParameters;
}
In the whichSearch user function, all the AS parameters should be redefined.
The parameter whichSearch will be interpreted by POST variable from a form but could be also interpreted as a GET variable.
If POST["whichSearch"] or GET["whichSearch"] exists, then all the AS parameter from the configuration file overwrite the AS parameters provided by the snippet call.
Regarding
Can a Firefox/IE search plugin be made using AjaxSearch? question. I think that it is feasable, but only by using the whichSearch parameter.
In this case the plug-in open a window with the input form area and &advSearch parameter choice and by default call an url with the appropriate already defined whichSearch parameter.
Thanks for your feedbacks about this solution/suggestion.