[SPT/CWIS] Datamodel, MySQL query and Custom RSS feed

Edward Almasy ealmasy at scout.wisc.edu
Wed Jul 2 12:12:13 CDT 2008


On Jul 1, 2008, at 4:12 PM, Jhonatan Tirado wrote:
> Thanks for your answer,
> But, How do I do and internal search engine query?
> The URL for Advanced Search is this:
> http://peru.campusvirtualsp.org/repositorio/SPT--Advanced.php

I think what Rich is talking about is the URL that you get when you do  
an Advanced Search.  For example:
     http://amser.org/SPT--AdvancedSearch.php?Q=Y&F4=bbc&RP=5&SR=0&ST=Advanced
The "F4" parameter indicates that I was searching for "bbc" in the Url  
field (which has a field ID of 4).

To use the internal OSMASE search engine to do a search, it would be  
something like this:

require_once("include/SPT--SearchEngine.php");
$Engine = new SPTSearchEngine();
$SearchParameters = array("Type" => "=Course");
$Scores = $Engine->FieldedSearch($SearchParameters);

$Scores would then contain an array with the IDs of the resources  
found by the search as the indexes, and the relevance score for each  
resource as the values.  The code to turn that into RSS would be  
something like:

require_once("Axis--RSS.php");
$RSS = new RSS();
foreach ($Scores as $Id => $Score)
{
     $Resource = new Resource($Id);
     $RSS->AddItem(strip_tags($Resource->Get("Title")),
         "http://". 
$_SERVER["SERVER_NAME"].dirname($_SERVER["REQUEST_URI"])
             ."/SPT--FullRecord.php?ResourceId=".$Resource->Id(),
         strip_tags($Resource->Get("Description")),
         $Resource->Get("Date of Record Release"));
}
$RSS->PrintRSS();

(Caveat:  I wrote this all very quickly by hand, so there may be a  
typo or two.  A better example of using the RSS object can be found in  
SPT--RSS.php.)

Ed


---
    Edward Almasy                             ealmasy at scout.wisc.edu
    Co-Director                                 1210 W Dayton Street
    Internet Scout                                  Madison WI 53706
    Computer Sciences Department                608-262-6606 (voice)
    University of Wisconsin - Madison             608-265-9296 (fax)





More information about the SPT-CWIS-Users mailing list