Manoj,

In addition to the docs that Erik points to, you might look at the tutorial on 
the developer site, http://developer.marklogic.com/learn/rest.  In particular, 
the section on custom search has a lot of examples that might be helpful.

--Colleen

________________________________
From: [email protected] 
[[email protected]] on behalf of Erik Hennum 
[[email protected]]
Sent: Tuesday, January 22, 2013 8:36 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Strcutured query on Ml-6 Rest API

Hi, Majoj:

A structured query has two parts:

*  Persisted query options that identify the indexes you're querying against.
*  A query that supplies the criteria and any boolean composers for the 
criteria.

This two-part structure makes it possible to supply the query either with
a Google-like string or with a structure.

In JSON, here's the options structure for an element value query:

{"options":{"constraint":[
    {"name":"YOUR_CONSTRAINT_NAME",
      "value":{"element":{
          "name":"YOUR_ELEMENT_NAME",
          "ns":"YOUR_ELEMENT_NAMESPACE"}}}]}}

Here's the query structure for an element value query:

{"query":{"queries":[
    {"value-constraint-query":{
        "constraint-name":"YOUR_CONSTRAINT_NAME",
        "text":["YOUR_CRITERIA_VALUE"]}}]}}

For more detail, please see:

    http://docs.marklogic.com/guide/rest-dev/search


Erik Hennum

________________________________
From: [email protected] 
[[email protected]] on behalf of manoj viswanadha 
[[email protected]]
Sent: Tuesday, January 22, 2013 1:28 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Strcutured query on Ml-6 Rest API

HI all,

I have explored the different Features on ML-6 Rest API.

I have a small requirement where i will be using strcuturedQuery with 
element-value-query.
I want to search my results based on the particular element which i tried using 
below.

http://localhost/v1/search?structuredQuery=
 {"query":
{"element-value-query":
  {"element-name":"name of the element",
"text":["some value"]}}}&collection=collectionname&format=xml

Above query should search for the element with particular value but its giving 
all the results in database.

Can anyone help me in achieving this or how we can use structured query with 
any cts:query.

Thanks,
Manoj.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to