Take a look at the example here<http://docs.marklogic.com/guide/search-dev/search-api#id_97085>. You can add a qtextconst attribute that reflects the original query.
I did a blog post about this<http://blog.davidcassel.net/2011/08/unparsing-a-custom-facet/> a few years ago. May be dated (it predates structured queries), but I think the essentials are still accurate. -- Dave Cassel Developer Community Manager MarkLogic Corporation<http://www.marklogic.com/> From: Will Thompson <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Wednesday, January 28, 2015 at 3:47 PM To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] Search API: Can't unparse after <term> extension? (Using ML 7.0-4.1) I added an extension to my Search API options to transform terms into field-word-queries: declare function my:search-term( $ps as map:map, $term as element()?) as schema-element(cts:query) { document { cts:field-word-query( 'my-field', sdev:current($ps), $term/search:term-option[ not(starts-with(., "lang="))]/element cts:option { string() }) }/* , sdev:advance($ps) }; Parsing works exactly as expected, however unparse() throws an exception: "SEARCH-NONANNOTATED: (err:FOER0000) Non-annotated query" let $parsed := search:parse("test", <options xmlns="http://marklogic.com/appservices/search"> <term apply="search-term" ns="http://myns" at="/mymodule.xqm"> <empty apply="no-results" /> </term> </options>) return search:unparse($parsed) I poked around search-impl.xqy and tried to create my own <cts:annotation>, but I have not been successful. I suspect there is some nuance I'm missing. Any suggestions? Is this possible? It seems like it should be. Thanks, Will _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
