Xquery search on multiple keywords

raffo

New Member
I have written a basic XQuery that takes a parameter, performs a "contains" parameter on the data and returns the relevant data set.\[code\]let $search_term:= request:get-parameter("param1",0)return <root> { for $node in doc('http://localhost:8080/data/doc.xml')/root/node for $value in $node/element/value where contains((upper-case($value)), (upper-case($search_term))) order by $node/title return $node } <root>\[/code\]How would I go about extending this to search for multiple parameters. In my Java application, the user enters the search string in an edit box. Therefore the search string may contain many words. Currently, this code only allows for searching on the search string as one entire phrase.Is it possible to parse all of the words in a "param1" into a string sequence in XQuery and then perform a contains-any-of on this sequence. Finally, in extension, can I then order the results by the number of matches.Thanks.
 
Top