Hi Erik


Let me give you the full details I have been doing.



On search, I am retrieving the full document using the transformation and am 
converting the document from XML to JSON using ML 6 JSON API.



REST API Params:

q=&options=<<options name>>&collection=<<collection name>>&format=json



the options in the above are used to get the full documents instead of snippet 
and transform it to JSON using JSON APIand it's working as expected. As I am 
transforming the document into JSON I got into an issue with Boolean values as 
below



JSON Result:

{

meaningful_description: "Picture cards for high-utility words, with audio, in 
English and Spanish.",

additional_text: "",

viewable: true,

assignable: true,

schedulable: true,

searchable: true,

teacher_managed: false,

se_facing: true,

enrich: false

}



When searched on true or value constraint with true as the search keyword:

Please find the below response.

JSON Result:

{

meaningful_description: "Picture cards for high-utility words, with audio, in 
English and Spanish.",

additional_text: "",

viewable: null,

assignable: null,

schedulable: null,

searchable: null,

teacher_managed: false,

se_facing: null,

enrich: false

}



Reason:

When I tried investigating the reason for this, I figured that when true is 
searched the boolean values are wrapped with <span class="hit">true</span> - 
xml response(this is our custom highlighting wrapping instead of 
<higlighlight>true</highlight>).



Because of the value getting wrapped it seems the JSON API is converting the 
value to null.



Note: I have a schema defined for the document being returned so that all the 
datatypes are returned as expected (integers, boolean, strings etc)







Gnana



Gnanaprakash Bodireddy | Sr. Associate - Projects | IME | Cognizant Technology 
Solutions.



>>



Hi, Gnana:



Apologies -- I'm not sure enough about the searched document and query that 
exhibit the suspect behavior to know how to reproduce the issue.  Could you 
post a sample JSON fragment that's the target of the search and the actual 
query?





Thanks for applying the REST API to real-world problems (and for the 
encouraging feedback).





Erik Hennum



This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful.
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to