Re: [MarkLogic Dev General] fn:current-dateTime()

2017-01-04 Thread sweet frd
Hi All, Please find the below code snippet in which i have created an invoke and module xquery with same fn:current-dateTime() logging and returning result. As a result I can able to see the timestamp is different : 1. when an other xquery is called using invoke 2. when an other

Re: [MarkLogic Dev General] List of all the collections in the database using REST api

2017-01-04 Thread Bhushan Suryawanshi
Hi Charles, Thanks for your prompt reply. Both of the below suggestions provided works for me. Thanks & Regards, Bhushan Suryawanshi From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of Charles Greer Sent: Wednesday, January 4, 2017 4:47

Re: [MarkLogic Dev General] List of all the collections in the database using REST api

2017-01-04 Thread Charles Greer
Hi Bhushan, What you're looking for is a call to /v1/values to fetch the collection lexicon. For XQuery, the code you included would not scale, what you'll want is something calling cts:collections() >From REST, you need an options file and a call to get a named collection options.xml:

[MarkLogic Dev General] List of all the collections in the database using REST api

2017-01-04 Thread Bhushan Suryawanshi
Hello Guys, I was working on MarkLogic 8 using REST API. I want to retrieve all the collections associated with the documents in the database. After going through search documents, We can use the following code: let $collections := for $doc in fn:doc() return

[MarkLogic Dev General] Getting element/attribute names and their usage frequency using Rest API

2017-01-04 Thread Bhushan Suryawanshi
Hello Guys, I was working on MarkLogic 8 using REST API. I want to retrieve all the element and attributes of a XML/JSON document using REST API. I have went through the MarkLogic documentation and couldn't find a way. Consider the following XML: ... . I want my search results to

Re: [MarkLogic Dev General] sort-order is not working with REST

2017-01-04 Thread Erik Hennum
Hi, Shiv: "field" has a special meaning in MarkLogic -- creating a range index on a field is different from creating a range index on a JSON property (which is done by treating the JSON property as an element with no namespace). QBE doesn't support fields on the grounds that QBE works with

Re: [MarkLogic Dev General] sort-order is not working with REST

2017-01-04 Thread Shiv Shankar
Hi Eric, Yes, range index is there for that field. --Shan. On Wed, Jan 4, 2017 at 2:03 PM, Shiv Shankar wrote: > Thanks Eric, > With this change, I could get the data, but no order change though the > sort-order specified ascending/descending. > Lets say firstName

Re: [MarkLogic Dev General] sort-order is not working with REST

2017-01-04 Thread Erik Hennum
Hi, Shiv: Does a range index exist on the JSON property? That's necessary to sort on a property. Erik Hennum From: general-boun...@developer.marklogic.com [general-boun...@developer.marklogic.com] on behalf of Shiv Shankar [shiv.shivshan...@gmail.com] Sent:

Re: [MarkLogic Dev General] sort-order is not working with REST

2017-01-04 Thread Shiv Shankar
Thanks Eric, With this change, I could get the data, but no order change though the sort-order specified ascending/descending. Lets say firstName is "abc", "xyz", the query returning the response in the same order irrespective of sort-order. Am I missing anything? Regards Shan. On Wed, Jan 4,

Re: [MarkLogic Dev General] sort-order is not working with REST

2017-01-04 Thread Erik Hennum
Hi, Shiv: The $query and options can be sibling properties in a QBE payload for MarkLogic 8. The basic JSON structure when combining a query and options is: {"search":{ "$query": ... the QBE query ..., "$format": ... the QBE optional format ..., "$validate": ... the

[MarkLogic Dev General] sort-order is not working with REST

2017-01-04 Thread Shiv Shankar
Hi, I am trying to use sort-order in $query. It is returning 0 records. All my documents are JSON. Any inputs? {"$query":{"options":{"sort-order":[{"direction":"descending","element":{"name":"firstName","score": null}}]}}} Tried with