marklogic-community / Corona

Community REST API for MarkLogic
Other
37 stars 9 forks source link

Strange response to query #1

Closed dscape closed 12 years ago

dscape commented 13 years ago

Request

  http://localhost:4380/json/query?q=fox

Response

{"meta":{"start":1,"end":1,"total":2},"results":[{"uri":"/foo/another_snow","content":{"foo":"to find something you could eat fox"}}]}

Question: If I didn't state start and end shouldnt this return both results that match?

ryangrimm commented 13 years ago

Yes, we could have these types of requests return all of the matches, but what about the case when there is 1,000,000 matches? That's not a response that anyone wants. So I in going along with the idea that the defaults should all be fast and efficient, simply returning the first result seemed like a prudent thing to do.

dscape commented 13 years ago

What about returning 10? That seems reasonable.

Also any advice on how to fix the test?

Nuno

On Tue, Sep 6, 2011 at 4:32 PM, isubiker reply@reply.github.com wrote:

Yes, we could have these types of requests return all of the matches, but what about the case when there is 1,000,000 matches?  That's not a response that anyone wants.  So I in going along with the idea that the defaults should all be fast and efficient, simply returning the first result seemed like a prudent thing to do.

Reply to this email directly or view it on GitHub: https://github.com/marklogic/Corona/issues/1#issuecomment-2017219

ryangrimm commented 13 years ago

We could return the first 10. But I went with just one to be consistant with how the kvquery operates. Open to changes.

As far as fixing the test, I'm not sure what the test is so I can't offer any suggestions :).

eedeebee commented 13 years ago

1 - feels like a minor issue. 2 - the current default is rarely if ever what you want, right? 3 - first 10 seems reasonable to me

ryangrimm commented 12 years ago

Start still exits but end has been changed to length. Length defaults to 10 for /search and 1 for /kvquery.