Search:Search API not returning correct output

h4ck3d

New Member
I have the following xml document containing three patent-assignment tags\[code\]<patent-assignments> <patent-assignment> <patent-assignors> <patent-assignor> <name>TSAI, YU-WEN</name> </patent-assignor> </patent-assignors> <patent-assignees> <patent-assignee> <name>FARADAY TECHNOLOGY CORP.</name> </patent-assignee> </patent-assignees> </patent-assignment> <patent-assignment> <patent-assignors> <patent-assignor> <name>APPLE</name> </patent-assignor> </patent-assignors> <patent-assignees> <patent-assignee> <name>GOOGLE INC</name> </patent-assignee> </patent-assignees> </patent-assignment> <patent-assignment> <patent-assignors> <patent-assignor> <name>GOOGLE INC</name> </patent-assignor> </patent-assignors> <patent-assignees> <patent-assignee> <name>FARADAY TECHNOLOGY CORP.</name> </patent-assignee> </patent-assignees> </patent-assignment></patent-assignments>\[/code\]Now when I run the following search query:-\[code\] import module namespace search="http://marklogic.com/appservices/search" at "/Marklogic/appservices/search/search.xqy";declare variable $options:= <options xmlns="http://marklogic.com/appservices/search"> <transform-results apply="raw"/> </options>;search:search("apple", $options, 1, 1)/search:result\[/code\]I get the full document as the output but matching word "APPLE" is in only second patent-assignment tag of the xml. I want to get only second patent-assignment as the output not the full document. If I use snippets then it shows the document and element name where it finds the match but it did not return the actual output. I want that particular patent-assignment tag as the output where the matching word is found.
 
Back
Top