Ask Your Question
0

SOLR parameters in REST API

asked 2014-05-29 03:34:08 -0500

anonymous user

Anonymous

Hello. I am trying to use parameter rows in the url like this:

curl -X GET $NODE/v1/query/solr/?q=isDocumentedBy:"%5B*%20TO%20*%5B"&rows=1000

but the execution recognizes only the first part, not recognizing rows. I also tried escaping the ampersand. Is there a way to get more than 10 query results? Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-05-29 07:06:28 -0500

vieglais gravatar image

The query string decoded is:

/v1/query/solr/?q=isDocumentedBy:"[* TO *["&rows=1000

Which is attempting to perform a literal search on the value "[* TO *[" within the isDocumentedBy field. It looks like the query is intended to find all documents that have a isDocumentedBy value. The correct form for such a query is:

q=isDocumentedBy:[* TO *]

encoded as a URL fragment would be:

isDocumentedBy%3A%5B*%20TO%20*%5D

The full URL would then be something like:

${NODE}/v1/query/solr/?q=isDocumentedBy%3A%5B*%20TO%20*%5D&rows=100

which is a very verbose response. The list of fields returned may be restricted using the "fl" parameter, so for example, to retrieve the list of identifiers of objects that have an isDocumentedBy entry:

${NODE}/v1/query/solr/?q=isDocumentedBy%3A%5B*%20TO%20*%5D&rows=100&fl=id

A list of identifiers could then be retrieved by processing the resulting xml using a tool such as xmlstarlet:

NODE="https://cn.dataone.org/cn"
curl -s "${NODE}/v1/query/solr/?q=isDocumentedBy%3A%5B*%20TO%20*%5D&rows=100&fl=id" | \
xmlstarlet sel -t -m "//doc" -v "str[@name='id']" -n

with the result:

doi:10.6085/AA/SHLX00_XXXIBTNXTSR01_20120815.40.1
ark:/13030/m5vt1qt7/2/cadwsap-s3600375-001-vuln.csv
ark:/13030/m5vt1qt7/2/cadwsap-s3600375-001.pdf
...
doi:10.6085/AA/SCPXXX_015MTBD003R00_20021018.40.1

Which is a list of all objects that are documented by some other object as asserted by an OAI-ORE resource map document.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Stats

Asked: 2014-05-29 03:34:08 -0500

Seen: 19,733 times

Last updated: May 29 '14