[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

searching multiple fields

  • To: xml-dev@l...
  • Subject: searching multiple fields
  • From: "Michele Hampshire" <swanroad@p...>
  • Date: Wed, 03 Dec 2003 18:41:40 -0800 (PST)

search 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 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.