Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XPath, Parsing Question 1

Status
Not open for further replies.

Beta14

MIS
Jan 25, 2010
3
US
Hi,

I have a search box on a html page that is not working properly. I think XPath might be the answer but I am not sure. (I am new to this). Basically the search box has a radio button operator with two choices: "AND" and "OR"

When a user types a search item in such as the terms: GUI Graphical User Interface, the search does not know that GUI and "Graphical User Interface" are two separate terms so it interprets the AND selection to be: GUI AND Graphical AND User AND Interface. The OR selection is interpreted as: GUI OR Graphical OR User OR Interface.

If the search was working correctly, I would enter the search text GUI OR "Graphical User Interface" and it would know that I would like to search by either term. You must use the quotes to enclose a phrase that includes spaced between words.

Below is the relevant code for how the words are being parsed:

Code:
if(arrayTemp[0] == "searchString") { 
 strTemp = '' 
 arrayKey [j] = arrayTemp[0]; 
 arrayTempKeyword = arrayTemp[1].split('+'); 
 for(k=0; k<arrayTempKeyword.length; k++) { 
 strTemp += unescape(arrayTempKeyword[k]) + " "; 
 }//for 
 strTemp = strTemp.substring(0,strTemp.length-1); 
 arrayValue [j] = strTemp 
 }

Anyone have any ideas?

Thanks in advance for this!
 
>I think XPath might be the answer but I am not sure. (I am new to this).
Since you say you are new to xpath, I can tell you that it has nothing to do with xpath. You can pose the question on the needed functionality to javascript forum and spare the mentioning of xpath because it has nothing to do with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top