← Prev in month ← Prev in thread
Next in thread → Next in month →

searching multiple fields

From
Michele Hampshire <>
To
Date
2003-12-04T02:41:40Z
ID
<>
Thread
searching multiple fields
Hello, Each record in my database has one summary field
and up to three subject fields. The search function
below will return results from the summary field and
the first subject field only.  Is there an  adjustment
I can make so that all three subject fields are
searched? 

Regards, Michele
-------------------- 

function search(searchStr, searchType)
{
var pattern = /(\w)(\w*)/;  
var a = searchStr.split(/\s+/g); 
for (i = 0 ; i < a.length ; i ++ ) {
var parts = a[i].match(pattern); 
var firstLetter = parts[1].toUpperCase();
var restOfWord = parts[2].toLowerCase();
a[i] = firstLetter + restOfWord; 
}
searchStr = a.join(' '); 
var docRoot = dbDocument.documentElement;
if (docRoot == null)
alert("Document is null"); 
else 
{
products = docRoot.selectNodes("/images/image");
for (i = 0; i < products.length; i++)      
{
if (searchType[0].checked) 
{
prod =
docRoot.selectNodes("/images/image/summary").item(i);
}
else if (searchType[1].checked) 
{
prod =
docRoot.selectNodes("/images/image/subject").item(i);
}
if ( prod.text.search(searchStr) != -1) 
{
var cloneTree =
docRoot.selectNodes("/images/image").item(i).cloneNode(true);
resultSet.documentElement.insertBefore(cloneTree,
resultSet.documentElement.firstChild);
}
}
}

________________________________________________
PeoplePC:  It's for people. And it's just smart. 
http://www.peoplepc.com
← Prev in month ← Prev in thread
Next in thread → Next in month →