bpluly opened a new issue #3111:
URL: https://github.com/apache/couchdb/issues/3111


   The documentation at 
https://docs.couchdb.org/en/master/ddocs/search.html#queries includes examples 
for queries but shows the query= string wrapped in quotes. The parameter is not 
quoted. If you use it in curl as documented it will hang on the query.
   
   Developers no doubt figure this out but it can be avoided.
   Existing documentation examples.
   
   `````
   GET 
/$DATABASE/_partition/$PARTITION_KEY/_design/$DDOC/_search/$INDEX_NAME?include_docs=true&query="*:*"&limit=1
 HTTP/1.1
   Content-Type: application/json
   
   Example of using HTTP to query a global index:
   
   GET 
/$DATABASE/_design/$DDOC/_search/$INDEX_NAME?include_docs=true&query="*:*"&limit=1
 HTTP/1.1
   Content-Type: application/json
   
   Example of using the command line to query a partitioned index:
   
   curl https://$HOST:5984/$DATABASE/_partition/$PARTITION_KEY/_design/$DDOC/
   _search/$INDEX_NAME?include_docs=true\&query="*:*"\&limit=1 \
   
   Example of using the command line to query a global index:
   
   curl https://$HOST:5984/$DATABASE/_design/$DDOC/_search/$INDEX_NAME?
   include_docs=true\&query="*:*"\&limit=1 \
   
   ```
   
   The example of *:* is also misleading. It will return the default for the 
index which is likely to be all _id's in the database. But if an index is 
specified the value cannot start with either '?' or '*'. Perhaps something like:
   
   ```
   GET 
/$DATABASE/_partition/$PARTITION_KEY/_design/$DDOC/_search/$INDEX_NAME?include_docs=true&query=$index:$searchString&limit=1
 HTTP/1.1
   Content-Type: application/json
   
   Example of using HTTP to query a global index:
   
   GET 
/$DATABASE/_design/$DDOC/_search/$INDEX_NAME?include_docs=true&query=$index:$searchString&limit=1
 HTTP/1.1
   Content-Type: application/json
   
   Example of using the command line to query a partitioned index:
   
   curl https://$HOST:5984/$DATABASE/_partition/$PARTITION_KEY/_design/$DDOC/
   _search/$INDEX_NAME?include_docs=true\&query=$index:$searchString\&limit=1 \
   
   Example of using the command line to query a global index:
   
   curl https://$HOST:5984/$DATABASE/_design/$DDOC/_search/$INDEX_NAME?
   include_docs=true\&query=$index:$searchString\&limit=1 \
   
   NOTE
   Using *:* for the index and search string will use the default rule in the 
search index document. If this is the normal index('default', doc._id); then 
all documents in the database will be returned. In normal circumstances the 
search string cannot start with a wildcard (?,*).
   
   ```
   
   This should save some needless scratching of heads.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to