Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-13 Thread Geert Josten
Just a small addition: the expression that you provide to path indexes does not 
have to start with / nor with //. Compare it with XSLT match expressions, as 
opposed to XSLT select expressions.

Kind regards,
Geert

From: Indrajeet Verma 
indrajeet.ve...@gmail.commailto:indrajeet.ve...@gmail.com
Reply-To: MarkLogic Developer Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Date: Sunday, April 12, 2015 at 8:52 PM
To: MarkLogic Developer Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] How to find particular element using path 
index

Shashidhar - It's nice to hear that your problem solved. This should work with 
//product-reference/product-id/date as well. Main point is your path should 
point/return the value that you are trying to search/get.

As per my understanding this should be proper XPath that is searchable.

On Mon, Apr 13, 2015 at 1:11 AM, Shashidhar Rao 
raoshashidhar...@gmail.commailto:raoshashidhar...@gmail.com wrote:
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.commailto: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.commailto: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.commailto: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
countryIND/country
product-numberAA-503/product-number
product-typeapparel/product-type
date20130105/date
/product-id
/product-reference
store-reference
store-id
countryJP/country
store-number8369/store-number
date20120906/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.commailto:General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general


___
General mailing list
General

Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-13 Thread Indrajeet Verma
Thank you Geert for correcting me. I tried by excluding / ( e.g.
product-reference/product-id/date) from path index and it is working fine.

Could you please give some more reasons/suggestions why should we not use
/ or //?  as we tried with /  // and It was returning same result
as without these path separators.


Thank you!

On Mon, Apr 13, 2015 at 12:32 PM, Geert Josten geert.jos...@marklogic.com
wrote:

  Just a small addition: the expression that you provide to path indexes
 does not have to start with / nor with //. Compare it with XSLT match
 expressions, as opposed to XSLT select expressions.

  Kind regards,
 Geert

   From: Indrajeet Verma indrajeet.ve...@gmail.com
 Reply-To: MarkLogic Developer Discussion general@developer.marklogic.com
 Date: Sunday, April 12, 2015 at 8:52 PM
 To: MarkLogic Developer Discussion general@developer.marklogic.com
 Subject: Re: [MarkLogic Dev General] How to find particular element using
 path index

   Shashidhar - It's nice to hear that your problem solved. This should
 work with //product-reference/product-id/date as well. Main point is your
 path should point/return the value that you are trying to search/get.

  As per my understanding this should be proper XPath that is searchable.

 On Mon, Apr 13, 2015 at 1:11 AM, Shashidhar Rao 
 raoshashidhar...@gmail.com wrote:

   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
 countryIND/country
 product-numberAA-503/product-number
 product-typeapparel/product-type
 date20130105/date
 /product-id
 /product-reference
 store-reference
 store-id
 countryJP/country
 store-number8369/store-number
 date20120906/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

Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-13 Thread Geert Josten
Hi,

Using / makes it work for only one path. Using // or nothing in front means the 
same. I don’t really have a preference myself..

Cheers,
Geert

From: Indrajeet Verma 
indrajeet.ve...@gmail.commailto:indrajeet.ve...@gmail.com
Reply-To: MarkLogic Developer Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Date: Monday, April 13, 2015 at 8:33 AM
To: MarkLogic Developer Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] How to find particular element using path 
index

Thank you Geert for correcting me. I tried by excluding / ( e.g. 
product-reference/product-id/date) from path index and it is working fine.

Could you please give some more reasons/suggestions why should we not use / 
or //?  as we tried with /  // and It was returning same result as 
without these path separators.


Thank you!

On Mon, Apr 13, 2015 at 12:32 PM, Geert Josten 
geert.jos...@marklogic.commailto:geert.jos...@marklogic.com wrote:
Just a small addition: the expression that you provide to path indexes does not 
have to start with / nor with //. Compare it with XSLT match expressions, as 
opposed to XSLT select expressions.

Kind regards,
Geert

From: Indrajeet Verma 
indrajeet.ve...@gmail.commailto:indrajeet.ve...@gmail.com
Reply-To: MarkLogic Developer Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Date: Sunday, April 12, 2015 at 8:52 PM
To: MarkLogic Developer Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] How to find particular element using path 
index

Shashidhar - It's nice to hear that your problem solved. This should work with 
//product-reference/product-id/date as well. Main point is your path should 
point/return the value that you are trying to search/get.

As per my understanding this should be proper XPath that is searchable.

On Mon, Apr 13, 2015 at 1:11 AM, Shashidhar Rao 
raoshashidhar...@gmail.commailto:raoshashidhar...@gmail.com wrote:
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.commailto: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.commailto: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.commailto: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
countryIND/country
product-numberAA-503/product-number
product-typeapparel/product-type
date20130105/date
/product-id
/product-reference
store-reference
store-id
countryJP/country
store-number8369/store-number
date20120906/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

Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-13 Thread Indrajeet Verma
Thank you Geert!

On Mon, Apr 13, 2015 at 7:57 PM, Geert Josten geert.jos...@marklogic.com
wrote:

  Hi,

  Using / makes it work for only one path. Using // or nothing in front
 means the same. I don’t really have a preference myself..

  Cheers,
 Geert

   From: Indrajeet Verma indrajeet.ve...@gmail.com
 Reply-To: MarkLogic Developer Discussion general@developer.marklogic.com
 Date: Monday, April 13, 2015 at 8:33 AM

 To: MarkLogic Developer Discussion general@developer.marklogic.com
 Subject: Re: [MarkLogic Dev General] How to find particular element using
 path index

   Thank you Geert for correcting me. I tried by excluding / ( e.g.
 product-reference/product-id/date) from path index and it is working fine.

  Could you please give some more reasons/suggestions why should we not
 use / or //?  as we tried with /  // and It was returning same
 result as without these path separators.


  Thank you!

 On Mon, Apr 13, 2015 at 12:32 PM, Geert Josten geert.jos...@marklogic.com
  wrote:

  Just a small addition: the expression that you provide to path indexes
 does not have to start with / nor with //. Compare it with XSLT match
 expressions, as opposed to XSLT select expressions.

  Kind regards,
 Geert

   From: Indrajeet Verma indrajeet.ve...@gmail.com
 Reply-To: MarkLogic Developer Discussion general@developer.marklogic.com
 
 Date: Sunday, April 12, 2015 at 8:52 PM
 To: MarkLogic Developer Discussion general@developer.marklogic.com
 Subject: Re: [MarkLogic Dev General] How to find particular element
 using path index

   Shashidhar - It's nice to hear that your problem solved. This should
 work with //product-reference/product-id/date as well. Main point is your
 path should point/return the value that you are trying to search/get.

  As per my understanding this should be proper XPath that is searchable.

 On Mon, Apr 13, 2015 at 1:11 AM, Shashidhar Rao 
 raoshashidhar...@gmail.com wrote:

   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
 countryIND/country
 product-numberAA-503/product-number
 product-typeapparel/product-type
 date20130105/date
 /product-id
 /product-reference
 store-reference
 store-id
 countryJP/country
 store-number8369/store-number
 date20120906/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

Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-12 Thread Erik Hennum
Hi, Shashidhar:

Thanks for clarifying.  Did you create a search:values element?

http://docs.marklogic.com/search:values

The values() request uses a search:values definition that contains the range 
index specification.


Erik Hennum


From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Shashidhar Rao 
[raoshashidhar...@gmail.com]
Sent: Sunday, April 12, 2015 10:49 AM
To: general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] How to find particular element using path 
index

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.commailto: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
countryIND/country
product-numberAA-503/product-number
product-typeapparel/product-type
date20130105/date
/product-id
/product-reference
store-reference
store-id
countryJP/country
store-number8369/store-number
date20120906/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


Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-12 Thread Erik Hennum
Hi, Shashidhar:

Did you create the path range index in the Admin UI?

The /publication-reference/date path in the constraint definition below doesn't 
match the name of the product-reference element below.

You might also doublecheck the 'date' search:values definition (not shown 
below).


Hoping that helps,


Erik Hennum


From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Shashidhar Rao 
[raoshashidhar...@gmail.com]
Sent: Sunday, April 12, 2015 9:13 AM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] How to find particular element using path index

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
countryIND/country
product-numberAA-503/product-number
product-typeapparel/product-type
date20130105/date
/product-id
/product-reference
store-reference
store-id
countryJP/country
store-number8369/store-number
date20120906/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


Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-12 Thread Shashidhar Rao
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
 countryIND/country
 product-numberAA-503/product-number
 product-typeapparel/product-type
 date20130105/date
 /product-id
 /product-reference
 store-reference
 store-id
 countryJP/country
 store-number8369/store-number
 date20120906/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


Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-12 Thread Erik Hennum
Hi, Shashidhar:

Does the configuration of the path index in the Admin UI specify the same data 
type (string with the same collation)?

If so, it might be time to add search:debugtrue/search:debug to the options 
and get the response with a string handle so you can see what's being executed 
on the server.


Erik Hennum


From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Shashidhar Rao 
[raoshashidhar...@gmail.com]
Sent: Sunday, April 12, 2015 11:32 AM
To: general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] How to find particular element using path 
index

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.commailto: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.commailto: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
countryIND/country
product-numberAA-503/product-number
product-typeapparel/product-type
date20130105/date
/product-id
/product-reference
store-reference
store-id
countryJP/country
store-number8369/store-number
date20120906/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


Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-12 Thread Indrajeet Verma
Shashidhar - I think, your path range index is not right.

I did below steps and showing result. Please see if this helps.

XML-
---
product
  product-reference
product-id
  countryIND/country
  product-numberAA-503/product-number
  product-typeapparel/product-type
  date20130105/date
/product-id
  /product-reference
  store-reference
store-id
  countryJP/country
  store-number8369/store-number
  date20120906/date
/store-id
  /store-reference
/product



CODE-
--
import module namespace search = http://marklogic.com/appservices/search;
at /MarkLogic/appservices/search/search.xqy;

declare variable $OPTIONS :=
 options xmlns=http://marklogic.com/appservices/search;
 values name=datepath
 range type=xs:string
path-index/product/product-reference/product-id/date/path-index
   /range
/values
return-valuestrue/return-values
/options ;

let $options :=
options xmlns=http://marklogic.com/appservices/search;
{$OPTIONS/*}
/options
let $search-results := search:values('datepath', $options)
return $search-results

RESULT-
---
values-response name=datepath type=xs:string xmlns=
http://marklogic.com/appservices/search; xmlns:xs=
http://www.w3.org/2001/XMLSchema;
  distinct-value frequency=120130105/distinct-value
  metrics
values-resolution-timePT0.001S/values-resolution-time
total-timePT0.002S/total-time
  /metrics
/values-response

Range Index-
-

[image: Inline image 1]


On Mon, Apr 13, 2015 at 12:15 AM, Erik Hennum erik.hen...@marklogic.com
wrote:

  Hi, Shashidhar:

 Does the configuration of the path index in the Admin UI specify the same
 data type (string with the same collation)?

 If so, it might be time to add search:debugtrue/search:debug to the
 options and get the response with a string handle so you can see what's
 being executed on the server.


   Erik Hennum

--
 *From:* general-boun...@developer.marklogic.com [
 general-boun...@developer.marklogic.com] on behalf of Shashidhar Rao [
 raoshashidhar...@gmail.com]
 *Sent:* Sunday, April 12, 2015 11:32 AM
 *To:* general@developer.marklogic.com
 *Subject:* Re: [MarkLogic Dev General] How to find particular element
 using path index

   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
 countryIND/country
 product-numberAA-503/product-number
 product-typeapparel/product-type
 date20130105/date
 /product-id
 /product-reference
 store-reference
 store-id
 countryJP/country
 store-number8369/store-number
 date20120906/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

Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-12 Thread Shashidhar Rao
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
 countryIND/country
 product-numberAA-503/product-number
 product-typeapparel/product-type
 date20130105/date
 /product-id
 /product-reference
 store-reference
 store-id
 countryJP/country
 store-number8369/store-number
 date20120906/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


Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-12 Thread Shashidhar Rao
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
 countryIND/country
 product-numberAA-503/product-number
 product-typeapparel/product-type
 date20130105/date
 /product-id
 /product-reference
 store-reference
 store-id
 countryJP/country
 store-number8369/store-number
 date20120906/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


Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-12 Thread Indrajeet Verma
Shashidhar - It's nice to hear that your problem solved. This should work
with //product-reference/product-id/date as well. Main point is your path
should point/return the value that you are trying to search/get.

As per my understanding this should be proper XPath that is searchable.

On Mon, Apr 13, 2015 at 1:11 AM, Shashidhar Rao raoshashidhar...@gmail.com
wrote:

 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
 countryIND/country
 product-numberAA-503/product-number
 product-typeapparel/product-type
 date20130105/date
 /product-id
 /product-reference
 store-reference
 store-id
 countryJP/country
 store-number8369/store-number
 date20120906/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


___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] How to find particular element using path index

2015-04-12 Thread Shashidhar Rao
Thanks Indrajeet ,it worked this time and got the results I started from
the root after seeing you screenshot. Really appreciate your help a big
thanks to you and you saved my job.

Thanks to all who have given me suggestions. This marklogic forum is just
great .

On Mon, Apr 13, 2015 at 1:11 AM, Shashidhar Rao raoshashidhar...@gmail.com
wrote:

 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
 countryIND/country
 product-numberAA-503/product-number
 product-typeapparel/product-type
 date20130105/date
 /product-id
 /product-reference
 store-reference
 store-id
 countryJP/country
 store-number8369/store-number
 date20120906/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