Thanks Indrajeet for the code. But as I look into your range path index
admin ui configuration one thing I observed, you started from the root
element and whereas I started in the from product reference. Probably you
path is correct one i guess

Maybe this is where I got it wrong , but do you really have to start from
the root element say in this case I could start say
//product-reference/product-id/date .


But yes I think I forgot that product id.

Thanks a lot

On Mon, Apr 13, 2015 at 12:02 AM, Shashidhar Rao <raoshashidhar...@gmail.com
> wrote:

> My search values in java code
>
> QueryOptionsManager optionsMgr = client.newServerConfigManager()
>                 .newQueryOptionsManager();
> String optionXml = "<search:options "
>                 + "xmlns:search='http://marklogic.com/appservices/search
> '>"
>                 + "<search:values name='datepath'>"
>                 + "<search:range collation='
> http://marklogic.com/collation/' type='xs:string'>"
>                 +
> "<search:path-index>/product-reference/date</search:path-index>" +
> "</search:range>"
>                 + "</search:values>" + "</search:options>";
>
>             StringHandle writeHandle = new StringHandle(optionXml);
>             optionsMgr.writeOptions("datepath", writeHandle);
>
>             QueryManager queryMgr = client.newQueryManager();
>             ValuesDefinition query = queryMgr.newValuesDefinition(
>                 "datepath","datepath");
>             ValuesHandle values = queryMgr.values(query, new
> ValuesHandle());
>
>           for (CountedDistinctValue value : values.getValues()) {
>             String textValue = value.get("xs:string", String.class);
>             System.out.println(textValue );
>           }
>
> On Sun, Apr 12, 2015 at 11:19 PM, Shashidhar Rao <
> raoshashidhar...@gmail.com> wrote:
>
>> Sorry that was a typo from my side and yes I created the path index in
>> admin ui
>> <constraint name='date'>
>>     <range collation='http://marklogic.com/collation/' type='xs:string'
>> facet='false'>
>>     <path-index>/product-reference/date</path-index>
>>        </range>
>>  </constraint>
>> But still I could not get the results.
>> Error : Local message: search failed: Bad Request. Server Message: null
>>
>>
>>
>> On Sun, Apr 12, 2015 at 9:43 PM, Shashidhar Rao <
>> raoshashidhar...@gmail.com> wrote:
>>
>>> Hi ,
>>> Below is the structure of my document. I want to find the date under the
>>> <product-reference> and not the date from the <store-reference>.
>>>
>>> XML-STRUCTURE
>>>
>>> <product-reference>
>>> <product-id>
>>> <country>IND</country>
>>> <product-number>AA-503</product-number>
>>> <product-type>apparel</product-type>
>>> <date>20130105</date>
>>> </product-id>
>>> </product-reference>
>>> <store-reference>
>>> <store-id>
>>> <country>JP</country>
>>> <store-number>8369</store-number>
>>> <date>20120906</date>
>>> </store-id>
>>> </store-reference>
>>>
>>> I have create this optionsname as "date-product" and constraint as
>>>
>>> <constraint name='date'>
>>>     <range collation='http://marklogic.com/collation/' type='xs:string'
>>> facet='false'>
>>>     <path-index>/publication-reference/date</path-index>
>>>        </range>
>>>  </constraint>
>>>
>>> JAVA CODE
>>>
>>>       QueryManager queryMgr = client.newQueryManager();
>>>         ValuesDefinition query =
>>> queryMgr.newValuesDefinition("date-product",
>>>                 "date");
>>>       ValuesHandle values = queryMgr.values(query, new ValuesHandle());
>>>
>>>         for (CountedDistinctValue value : values.getValues()) {
>>>             String textValue = value.get("xs:string", String.class);
>>>              System.out.println(textValue );
>>>         }
>>> I am not getting any results.
>>>
>>> Am I missing something or could somebody correct my code or help me with
>>> how to find values with path-index with range element index I am getting
>>> the results.
>>>
>>> Thanks
>>>
>>>
>>>
>>
>
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to