Any suggestions on why I get an XDMP-ARGTYPE error when I mix custom
constraints with special handling of unconstrained terms in search:search?

[1.0-ml] XDMP-ARGTYPE: (err:XPTY0004) fn:string((text{"mitt"},
text{"mitt"}, text{"mitt"}, ...)) -- arg1 is not of type item?

As I describe below, either one on their own works fine.

Regards,

Stuart


On Mon, Jul 23, 2012 at 4:17 PM, Stuart Myles <stuart.my...@gmail.com>wrote:

> In the search:search API, I can either have a custom constraint *or*
> special handling of unconstrained terms, but not both.
>
> Here is a bit of code that illustrates what I'm trying to do:
>
> https://gist.github.com/3165844
>
> xquery version "1.0-ml";
> import module namespace
>   search = "http://marklogic.com/appservices/search";
>   at "/MarkLogic/appservices/search/search.xqy";
>
> let $optionsconstraints :=
> <optionsconstraints xmlns="http://marklogic.com/appservices/search";>
> <constraint name="ovparty">
>     <custom facet="false">
>         <parse apply="ovparty" ns="http://stuartmyles.com/ns/mysearch"; 
> at="/b-custom-constraint.xqy"/>
>     </custom>
> </constraint>
> </optionsconstraints>
>
> let $options :=
>     <options xmlns="http://marklogic.com/appservices/search";>
>         {
>           $optionsconstraints//search:constraint
>         }
>             <term apply="myterm" ns="http://try.marklogic.com/search-options";
>                          at="/search-options.xqy">
>               <empty apply="all-results"/>
>             </term>
>             </options>
>
> let $optionsgood :=
>     <options xmlns="http://marklogic.com/appservices/search";>
>         {   $optionsconstraints//search:constraint}
>             </options>
>
> return search:search("ovparty:mitt", $options)
>
> When I pass $optionsgood to search:search, I can successfully search against 
> my ovparty constraint, which is defined in the file b-custom-constrain.xqy:
>
> https://gist.github.com/3165861
>
> However, when I use $options instead, I get an error:
>
>
> [1.0-ml] XDMP-ARGTYPE: (err:XPTY0004) fn:string((text{"mitt"}, text{"mitt"}, 
> text{"mitt"}, ...)) -- arg1 is not of type item?
>
> That's because I apply the function "myterm" to unconstrained terms. The 
> function myterm is defined in search-constraints.xqy:
>
> https://gist.github.com/3165889
>
> The "myterm" function is based very heavily on the one provided in the 
> "Ninja" tutorial:
>
> http://developer.marklogic.com/try/ninja/page13
>
> So, how do I get these two functions to co-exist?
>
> I'm running MarkLogic 5.0 under Windows XP.
>
>
> [image: MarkLogic Server] <http://localhost:8001/>
> [image: Standard Edition] <http://localhost:8001/>
>
> 5.0-1.2
>
> Thanks in advance for any help!
>
>
> Regards,
>
>
> Stuart
>
>
>
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to