• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

xmlsearch needs exact text to return anything

New Here ,
Oct 28, 2009 Oct 28, 2009

Copy link to clipboard

Copied

How do you create a wildcard search using xmlsearch? Or a search that will return records matching some of the words entered in the query (in other words the query does not require the exact text to be entered to return the record.)? For example, if I want to search for "Network Support Technician" I cannot enter "Network Support" and get the results to come up, I'll have to enter "Network Support Technician" to get any results.  (code is below)

<cfhttp url="http://www.server/webpage.cfm" method="GET">
</CFHTTP>


<CFSet xml=CFHTTP.FileContent>
<CFSet xmlDoc = XMLParse(xml)>


<cfset results = XMLSearch(xmlDoc, "//job[TITLE_STRING='#form.JobTitle#']")/>    

TOPICS
Advanced techniques

Views

404

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 28, 2009 Oct 28, 2009

Copy link to clipboard

Copied

xpath 1.0 supports a range of string functions.  It's perhaps an idea to have a read through this: http://www.w3.org/TR/xpath.  Or perhaps if you want something slightly less impenetrable: http://www.w3schools.com/XPath/xpath_functions.asp.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2009 Oct 28, 2009

Copy link to clipboard

Copied

LATEST

I ended up going with another method over the xmlsearch for this. I've included the code below

<CFSet xml=CFHTTP.FileContent>
<CFSet xmlDoc = XMLParse(xml)>
<cfset jobs = xmldoc.root.XmlChildren>
<cfset size = ArrayLen(jobs)>

<!--- create a query object with the job data --->
<cfset myquery = QueryNew("JobID, Title") >
<cfset temp = QueryAddRow(myquery, #size#)>
<cfloop index="i" from = "1" to = #size#>
    <cfset temp = QuerySetCell(myquery, "JobID",
        #xmldoc.root.job.jobpostingid_int.XmlText#, #i#)>
    <cfset temp = QuerySetCell(myquery, "Title",
        #LCase(xmldoc.root.job.TITLE_STRING.XmlText)#, #i#)>

</cfloop>

<!--- Select entries with the Title name starting with N and dump the result --->
<cfquery name="ImqTest" dbType="query">
   SELECT JobID, Title
   FROM myquery

where Title LIKE '#LCase(form.JobTitle)#%'

</cfquery>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation