You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
168 lines
4.3 KiB
168 lines
4.3 KiB
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" Content="Microsoft Developer Studio">
|
|
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<TITLE>Document Title</TITLE>
|
|
<OBJECT ID=pchealth classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7></OBJECT>
|
|
</HEAD>
|
|
|
|
<BODY>
|
|
<H1>Extensible Search Engine</H1>
|
|
<table>
|
|
<tr>
|
|
<td>Number of results returned</td><td><INPUT type=text id=numcount name=numcount></td>
|
|
</tr><tr>
|
|
<td>Query string</td><td><INPUT type="text" id="QueryString"></td>
|
|
</tr><tr>
|
|
<td>Full Text Search in Titles only</td><td><INPUT id=titleonly name=titleonly type=checkbox></td>
|
|
</tr><tr>
|
|
<td>Enable Search Engines</td><td><DIV ID=sectrl></DIV></td>
|
|
</tr>
|
|
</table>
|
|
<INPUT type="button" value="Execute Query" onClick="ExecQuery();">
|
|
<INPUT type="button" value="Abort" onClick="Abort();">
|
|
<DIV ID=out></DIV>
|
|
</BODY>
|
|
|
|
<SCRIPT LANGUAGE=javascript>
|
|
|
|
var g_semgr;
|
|
var seCount;
|
|
var resultstring;
|
|
|
|
function Print( line )
|
|
{
|
|
out.innerHTML = out.innerHTML + line + "<br>";
|
|
}
|
|
|
|
function SEMgrComplete(lSucceeded)
|
|
{
|
|
// clear out contents
|
|
out.innerHTML = "";
|
|
|
|
// enumerate all search engines
|
|
for(var e = new Enumerator( g_semgr.EnumEngine() ); !e.atEnd(); e.moveNext())
|
|
{
|
|
var SearchEng = e.item();
|
|
var resultstring;
|
|
|
|
resultstring = "<br>Results from " + SearchEng.Name;
|
|
resultstring = resultstring + "<table>";
|
|
resultstring = resultstring + "<tr><td>Title</td><td>Description</td><td>URI</td></tr>";
|
|
|
|
// enumerate all results
|
|
for (var r = new Enumerator( SearchEng.Result() ); !r.atEnd(); r.moveNext())
|
|
{
|
|
var Result = r.item();
|
|
resultstring = resultstring + "<tr><td><a href='" + Result.URI + "'>" + Result.Title + "</a></td><td>" + Result.Description + "</td><td>" + Result.URI + "</td></tr>";
|
|
}
|
|
|
|
resultstring = resultstring + "</table>";
|
|
Print(resultstring);
|
|
}
|
|
}
|
|
|
|
function SEMgrProgress(lDone, lTotal, SEName)
|
|
{
|
|
Print("SE Wrapper progress : lDone " + lDone + " lTotal : " + lTotal + " Name : " + SEName);
|
|
}
|
|
|
|
function Abort()
|
|
{
|
|
g_semgr.AbortQuery();
|
|
}
|
|
|
|
function ExecQuery()
|
|
{
|
|
var e = new Enumerator( g_semgr.EnumEngine() );
|
|
var c = new Enumerator( sectrl.all.tags("input") )
|
|
|
|
// Clear out result screen
|
|
out.innerHTML = "";
|
|
|
|
// Enumerate search engines and checkboxes
|
|
seCount = 0;
|
|
for(;!e.atEnd() && !c.atEnd();)
|
|
{
|
|
var SearchEng = e.item();
|
|
var CheckBox = c.item();
|
|
|
|
SearchEng.Enabled = CheckBox.checked;
|
|
|
|
c.moveNext();
|
|
e.moveNext()
|
|
}
|
|
|
|
// setup the query
|
|
g_semgr.NumResult = numcount.value
|
|
g_semgr.QueryString = QueryString.value;
|
|
|
|
// Callback for Search Engine Manager
|
|
g_semgr.OnComplete = SEMgrComplete;
|
|
g_semgr.OnProgress = SEMgrProgress;
|
|
|
|
// Get the Full text search parameter
|
|
if (document.all.titleonly.checked == true)
|
|
g_semgr.AddParam("Help Center Full Text Search", "TITLEONLY", true);
|
|
else
|
|
g_semgr.AddParam("Help Center Full Text Search", "TITLEONLY", false);
|
|
|
|
// Execute the query
|
|
g_semgr.ExecuteAsynchQuery();
|
|
}
|
|
|
|
//
|
|
// Initialize the SE Manager
|
|
//
|
|
g_semgr = pchealth.CreateObject_SearchEngineMgr();
|
|
g_semgr.NumResult = 10;
|
|
resultstring = "";
|
|
|
|
//
|
|
// Number of results
|
|
//
|
|
numcount.value = g_semgr.NumResult;
|
|
|
|
//
|
|
// Enumerate search engines
|
|
//
|
|
seCount = 0;
|
|
resultstring = resultstring + "<table>";
|
|
for(var e = new Enumerator( g_semgr.EnumEngine() ); !e.atEnd(); e.moveNext())
|
|
{
|
|
var SearchEng = e.item();
|
|
|
|
//
|
|
// Enable flag
|
|
//
|
|
if (SearchEng.Enabled)
|
|
{
|
|
resultstring = resultstring + "<tr><td><INPUT id=checkbox" + seCount + "cb name=checkbox" + seCount + " type=checkbox checked></td>";
|
|
}
|
|
else
|
|
{
|
|
resultstring = resultstring + "<tr><td><INPUT id=checkbox" + seCount + "cb name=checkbox" + seCount + " type=checkbox></td>";
|
|
}
|
|
|
|
//
|
|
// Name of the Search Engine
|
|
//
|
|
resultstring = resultstring + "<td>" + SearchEng.Name + "</td>";
|
|
|
|
for (var param = new Enumerator( SearchEng.Param(1033) ); !param.atEnd(); param.moveNext())
|
|
{
|
|
var ParamItem = param.item();
|
|
resultstring = resultstring + "<td>" + ParamItem.Type + "</td><td>" + ParamItem.Display + "</td><td>" + ParamItem.Name + "</td><td>" + ParamItem.Required + "</td></tr>";
|
|
}
|
|
|
|
seCount++;
|
|
}
|
|
|
|
//
|
|
// Print out the results
|
|
//
|
|
resultstring = resultstring + "</table>";
|
|
sectrl.innerHTML = resultstring;
|
|
|
|
</SCRIPT>
|
|
</HTML>
|