Database development and training for Birmingham and the midlands
Specialists in Microsoft Access and Visual Foxpro database training and development
I am happy to hear from existing clients but I am taking no new calls.
There is not enough room here to show all the code of the search routine so the description below is just the bare outline of the routine.
aHits = new Array();
// The keywords for each page
aKeyWord = new Array();
// The URL of each page
aURL = new Array();
// Page array sorted by number of hits
aSorted = new Array();
// Description of each page
aTitle = new Array();
The FoxPro code which builds the site parses each HTML document and pulls words from the Keyword and Description attributes to populate the arrays. These are the array members for the current page:
aTitle='Search page for Alvechurch Data web site';
Searching the Arrays
lcTarget = document.searchForm.searchFor.value.toLowerCase()
// Zero the hit counter and empty the array
// of hits
lnFound = 0
for (thisPage=1; thisPage < aKeyWord.length; thisPage++)
aHits[thisPage] = 0
// Break the target into an array of individual
// words then scan through the keyword array once
// for each of these words looking for a match.
for (lnWord = 0; lnWord < laWords.length; lnWord++)
for (thisPage=1; thisPage < aKeyWord.length;
if(laWords[lnWord] == "")
// Do nothing - this is a rogue thrown up by
// the split operation.
if (aKeyWord[thisPage].indexOf(laWords[lnWord]) > -1)
// First word found on the page so record
// that the search has a hit.
// Write the results or an apology in the
// centre of this page.
"No pages include '" + lcTarget + "'");
// We've found some pages
writeResult(loPlaceHolder, lnFound +
" pages found.");
showResults(loPlaceHolder, lnFound, lcTarget)