The error in the log is2015-05-10 15:46:45.132 Notice: carsearch: 
RESTAPI-INVALIDCONTENT: (err:FOER0000) Invalid content: Unexpected Payload:     
              sort            postedon        
2015-05-10 15:46:45.132 Notice: carsearch: in 
/MarkLogic/rest-api/models/config-query-model.xqy, at 154:27,
2015-05-10 15:46:45.132 Notice: carsearch: in config-query:put(map:map(<map:map 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:map="http://marklogic.com/xdmp/map";><map:entry 
key="content-type"><map:value xsi:type="xs:string">ap...</map:map>), 
map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:map="http://marklogic.com/xdmp/map";><map:entry 
key="named-option"><map:value xsi:type="xs:string">so...</map:map>), 
document{<query 
xmlns:search="http://marklogic.com/appservices/search";>&#9;<operator-state>&#9;&#9;<operator-name>sort</operator-name>&...</query>},
 eput:config-callback#2) [1.0-ml]
2015-05-10 15:46:45.132 Notice: carsearch:   $headers = map:map(<map:map 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:map="http://marklogic.com/xdmp/map";><map:entry 
key="content-type"><map:value xsi:type="xs:string">ap...</map:map>)
2015-05-10 15:46:45.132 Notice: carsearch:   $params = map:map(<map:map 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:map="http://marklogic.com/xdmp/map";><map:entry 
key="named-option"><map:value xsi:type="xs:string">so...</map:map>)
2015-05-10 15:46:45.132 Notice: carsearch:   $input = document{<query 
xmlns:search="http://marklogic.com/appservices/search";>&#9;<operator-state>&#9;&#9;<operator-name>sort</operator-name>&...</query>}
2015-05-10 15:46:45.132 Notice: carsearch:   $callback = eput:config-callback#2
2015-05-10 15:46:45.132 Notice: carsearch:   $content-type = "application/xml"
2015-05-10 15:46:45.132 Notice: carsearch:   $body = <query 
xmlns:search="http://marklogic.com/appservices/search";>&#9;<operator-state>&#9;&#9;<operator-name>sort</operator-name>&...</query>
2015-05-10 15:46:45.132 Notice: carsearch:   $named-option = "sortorderqueryp"
2015-05-10 15:46:45.132 Notice: carsearch:   $existing-options = ()
2015-05-10 15:46:45.132 Notice: carsearch:   $putative-result = 
"CONTENT_CREATED"
2015-05-10 15:46:45.132 Notice: carsearch: in 
/MarkLogic/rest-api/endpoints/config-query.xqy, at 53:8 [1.0-ml]
2015-05-10 15:46:45.134 Info: carsearch: Status 500: RESTAPI-INVALIDCONTENT: 
(err:FOER0000) Invalid content: Unexpected Payload:                        sort 
           postedonSorry missed sending this in the previous 
message.regards,Puneet
From: [email protected]
To: [email protected]
Date: Sun, 10 May 2015 15:34:33 +1000
Subject: Re: [MarkLogic Dev General] Search API : defining a new operator




Hi Joe,Thanks for your response. I realized I was not on the right track but I 
have slightly improvised . Now I am configuring 2 search optionFirst one 
defining the sort operator using following XML<?xml version="1.0"?><options 
xmlns="http://marklogic.com/appservices/search";>    <operator name="sort">      
    <state name="relevance">                        <sort-order>                
            <score/>                        </sort-order>           </state>    
            <state name="postedon">                 <sort-order 
direction="descending" type="xs:date">                              
<json-property>postedon</json-property>                 </sort-order>           
        <sort-order>                            <score/>                        
</sort-order>           </state>        </operator></options>
This one works without the error. Now when I am trying to define the state 
using a separate XML as follows
<?xml version="1.0"?><query 
xmlns:search="http://marklogic.com/appservices/search";>     <operator-state>    
            <operator-name>sort</operator-name>             
<state-name>postedon</state-name>       </operator-state></query>
I am getting the following error









{"errorResponse":{"statusCode":400, "status":"Bad Request", 
"messageCode":"RESTAPI-INVALIDCONTENT", "message":"RESTAPI-INVALIDCONTENT: 
(err:FOER0000) Invalid content: Unexpected Payload: \t\t\tsort\t\tpostedon\t"}}
> User-Agent: curl/7.30.0> Host: localhost:8040> Accept: */*> Content-type: 
> application/xml> Content-Length: 194> * upload completely sent off: 194 out 
> of 194 bytes< HTTP/1.1 400 Bad Request















< Content-type: application/json; charset=UTF-8
The data that I have is in JSON form and has postedon as date of the type 
"2015-04-11", Now the error seems to be about the structure but I am not able 
to understand.regards,Puneet


From: [email protected]
To: [email protected]
Date: Sun, 10 May 2015 05:05:54 +0000
Subject: Re: [MarkLogic Dev General] Search API : defining a new operator






Hi Puneet,



What's the HTTP status code from your search request? Are you getting an error 
in the response body, or simply a valid response with no results?



(If you're getting an error, you can find more  details in the MarkLogic error 
log at http://localhost:8001/get-error-log.xqy?filename=ErrorLog.txt)



Thanks.



-jb





From: Yinyan guy <[email protected]>

Reply-To: MarkLogic Developer Discussion <[email protected]>

Date: Saturday, May 9, 2015 at 9:12 PM

To: "[email protected]" <[email protected]>

Subject: Re: [MarkLogic Dev General] Search API : defining a new operator







Hi,
I was able to define the operator with following XML





<options xmlns="http://marklogic.com/appservices/search";>
<operator name="sort">
<state name="postedon">
<sort-order type="xs:date" direction="ascending">
<json-property>postedon</json-property>
</sort-order>
</state>
</operator>
</options>




I can confirm this when I check in http://localhost:8040/v1/config/query



But now I am not able to use it in my Search API, I am using the following url 
to verify the sort order
http://localhost:8040/v1/search?q=2015%20sort:postedon



I am not getting any results with the sort:postedon. I have create Element 
Range index & Field Range index on postedon of type date.



Do I need any other index to influence the sort order of my results? is the 
definition of the operator right?
Any tips on debugging it further would be helpful.



regards,
Puneet




From: [email protected]

To: [email protected]

Date: Sat, 9 May 2015 21:21:26 +1000

Subject: [MarkLogic Dev General] Search API : defining a new operator




Hi,
I am trying to define an operator sort:postedon to sort the search results in 
descending order of the date (json-property is postedon). I am using ML8 and my 
data is JSON files only. Following is my xml file




<options xmlns="http://marklogic.com/appservices/search";>
 <search:operator name="sort">
     <search:state name="postedon">
        <search:sort-order direction="descending" type="xs:date">
           <search:element ns="" json-property="postedon"/>
        </search:sort-order>
        <search:sort-order>
           <search:score/>
        </search:sort-order>
     </search:state>
 </search:operator>
</options>




And I am applying this search option using following command



curl -v -X PUT  --digest --user admin:admin  -H "Content-type: application/xml" 
-d @./SortOrder.xml 'http://localhost:8040/v1/config/query/sortorder'



On running the command I am getting the following error




{"errorResponse":{"statusCode":500, "status":"Internal Server Error", 
"messageCode":"INTERNAL ERROR", "message":"XDMP-DOCNONSBIND: 
xdmp:get-request-body(\"xml\") --
No namespace binding for prefix search at  line 1 . See the MarkLogic server 
error log for further detail."}}



Following is the entry in the server log



2015-05-09 21:05:49.176 Notice: carsearch: XDMP-DOCNONSBIND: 
xdmp:get-request-body("xml") -- No namespace binding for prefix search at  line 
1
2015-05-09 21:05:49.176 Notice: carsearch: in 
/MarkLogic/rest-api/endpoints/config-query.xqy, at 42:9 [1.0-ml]
2015-05-09 21:05:49.176 Notice: carsearch:   $headers = map:map(<map:map 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xmlns:map="http://marklogic.com/xdmp/map";><map:entry 
key="content-type"><map:value xsi:type="xs:string">ap...</map:map>)
2015-05-09 21:05:49.176 Notice: carsearch:   $method = "PUT"
2015-05-09 21:05:49.176 Notice: carsearch:   $params = map:map(<map:map 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xmlns:map="http://marklogic.com/xdmp/map";><map:entry 
key="named-option"><map:value xsi:type="xs:string">so...</map:map>)
 
I am following the examples in manuals at
https://docs.marklogic.com/guide/search-dev/query-options#id_30002



is the namespace "http://marklogic.com/appservices/search"; right?



Any tips to resolving it would be useful.
regards,
Puneet




_______________________________________________ General mailing list 
[email protected] Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general








_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general                         
                  

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general                         
                  
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to