Yes. the output of thsr:expand (which looks right) is not an element (according to search:unparse).
Matthew ________________________________ From: [email protected] [[email protected]] on behalf of Will Thompson [[email protected]] Sent: Friday, June 22, 2012 1:23 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] using search:parse/search:unparse and thsr:query-lookup/thsr:expand Have you tried thsr:expand()? -Will From: [email protected] [mailto:[email protected]] On Behalf Of Treskon, Matthew Sent: Friday, June 22, 2012 10:03 AM To: [email protected] Subject: [MarkLogic Dev General] using search:parse/search:unparse and thsr:query-lookup/thsr:expand Developer Forum, I am looking to expand our users’ queries using a thesaurus. We are using search:search with an extensive options node. I am looking to avoid having to recreate all parsing structures using string processing. Although string-join may work for simple queries, it becomes considerably more difficult when contending with nested sets (parenthesis), phrases (quotes, beginning and ending), and Boolean/other operators. Subsequently, I was hoping to use search:parse -> thsr:expand/thsr:query-lookup -> search:unparse. However, I am running into mixed-content type and annotation errors. This is basically what I am trying to do: let $q := <q>"tile drainage" AND (phosphorous OR nitrogen)</q> let $qparsed := search:parse($q,$OPTIONS) let $qexpanded := thsr:query-lookup("/myThsrDocs/NALT3.xml",$qparsed) let $qout := search:unparse(search:parse($qexpanded,$OPTIONS)) return $qout Is there a way to do this? So you don’t have to see our options node, $qparsed equals ' <cts:and-query qtextjoin="AND" strength="20" xmlns:cts="http://marklogic.com/cts"> <cts:word-query qtextpre=""" qtextref="cts:text" qtextpost="""> <cts:text>tile drainage</cts:text> <cts:option>punctuation-sensitive</cts:option> <cts:option>case-insensitive</cts:option> <cts:option>wildcarded</cts:option> </cts:word-query> <cts:or-query qtextjoin="OR" strength="10"> <cts:word-query qtextref="cts:text"> <cts:text>phosphorous</cts:text> <cts:option>punctuation-sensitive</cts:option> <cts:option>case-insensitive</cts:option> <cts:option>wildcarded</cts:option> </cts:word-query> <cts:word-query qtextref="cts:text"> <cts:text>nitrogen</cts:text> <cts:option>punctuation-sensitive</cts:option> <cts:option>case-insensitive</cts:option> <cts:option>wildcarded</cts:option> </cts:word-query> </cts:or-query> </cts:and-query> ' Thank you, Matthew ______________________________________ Matthew Treskon Digital Services Librarian--DigiTop National Agricultural Library US Department of Agriculture, ARS [email protected]<mailto:[email protected]> 765-494-8692 (Phone) 765-494-1705 (Fax) ...advancing access to global information for agriculture. ______________________________________ This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.
_______________________________________________ General mailing list [email protected] http://community.marklogic.com/mailman/listinfo/general
