[MarkLogic Dev General] Issue with operator in Search api
Colleen Whitney
Colleen.Whitney at marklogic.com
Fri Jun 8 10:23:15 PDT 2012
Will is right, if the operator sets the searchable expression it overrides a global one. The trouble could come in if you did something like provide two operators that both set searchable-expression, and both are used in a query.
________________________________________
From: general-bounces at developer.marklogic.com [general-bounces at developer.marklogic.com] On Behalf Of Micah Dubinko [Micah.Dubinko at marklogic.com]
Sent: Friday, June 08, 2012 9:14 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Issue with operator in Search api
It's hard to tell without seeing more of the code. It's certainly possible.
In Amit's stack trace he had two <searchable-expression> elements in a context where only one should be there, and I extrapolated from there.
Thanks, -m
On Jun 8, 2012, at 8:25 AM, Will Thompson wrote:
Hi Micah,
I use a global searchable expression and an operator state with a searchable expression, but when the operator state is invoked, it overrides the global one instead of appending it to the options. I know he got it working by eliminating the global, but could something else be going on? I’ve been depending on this override behavior since 4.2.
-Will
From: general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com> [mailto:general-bounces at developer.marklogic.com] On Behalf Of Micah Dubinko
Sent: Wednesday, June 06, 2012 9:43 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Issue with operator in Search api
Hi Amit,
Welcome.
First a bit of general advice, which you may have heard before. Run the function search:check-options often. Set up your build environment so that it runs every time you do a search. If it returns empty-sequence, you're golden, otherwise it's alerting you to current or potential problems. (It does in-depth checks which take time, so don't run it in a production environment).
It can be tricky to keep track of which config elements are allowed where, but check-options will keep you on the path.
It looks like the error below comes from having multiple <searchable-expression>s. Having one inside a <state> should be fine, but not with a global one too. Since your global one is pointing at fn:collection() which is the default anyway, you can get rid of it.
Try these and let us know how things turn out.
Thanks, -m
On Jun 6, 2012, at 9:27 PM, amit gope wrote:
Hello All,
I am new to search api and i am having trouble in implementing one functionality. There are basically two things that i am stuck with:
1. Can i have two operators in the options?
2. I have a code which looks something like this:
<operator name="sort">
<state name="relevance">
<sort-order>
<score/>
</sort-order>
</state>
<state name="date">
<sort-order direction="descending" type="xs:date" collation="">
<element ns="http://www.marklogic.com/app/meta" name="Date"/>
</sort-order>
<sort-order>
<score/>
</sort-order>
</state>
</operator>
<operator name="JournalOnlineFirst">
<state name="true">
<searchable-expression>/Publisher[.//JournalOnlineFirst]</searchable-expression>
</state>
</operator>
If my URL has an reads something like this "localhost:1234://..../q=issn:1573-4803<1234:/..../q=issn:1573-4803> journalonlinefirst:true&api_key=asdbfdas2342sfda" i want the api to fetch me those docs which are of the type JournalOnlineFirst. But i get the error as :"
XDMP-ARGTYPE: (err:XPTY0004) fn:in-scope-prefixes((<searchable-expression xmlns="http://marklogic.com/appservices/search">/Publisher[.//JournalOnlineFirst]</searchable-expression>, <searchable-expression xmlns="http://marklogic.com/appservices/search">fn:collection()</searchable-expression>)) -- arg1 is not of type element()"
Please suggest how to achieve the result because i am stuck at this place. I have also tried something like this.
"<operator name="JournalOnlineFirst">
<state name="true">
</state>
</operator>
<searchable-expression>/Publisher[.//JournalOnlineFirst]</searchable-expression>".
Here i dont get the result, but i dont get the error as well. Please let me know where i am going wrong. Thanks in advance.
Regards
Amit
_______________________________________________
General mailing list
General at developer.marklogic.com<mailto:General at developer.marklogic.com>
http://community.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
General at developer.marklogic.com<mailto:General at developer.marklogic.com>
http://community.marklogic.com/mailman/listinfo/general
More information about the General
mailing list