Cloudant query support#54
Conversation
There was a problem hiding this comment.
Not saying that this is the case, just sharing.... If you feel that there's a need for verb specific requests, e.g. PutIndexRequest that is fine. Rather that than a to generic one.
There was a problem hiding this comment.
I thought about PutIndexRequest but later on removed the prefix thinking that I might be able to reuse it for delete as well (for that too, it takes .similar params in request and returns just a success/failure msg).
There was a problem hiding this comment.
But does a DELETE need all that fields? MyCouch tries to stay away from generic requests so that it's clear what "params" exists for each request. I would start specific.
|
Looks nice! Great work! Added some inline feedback. BTW, if there are something you think should be changed in feature releases to make it simpler to work with, feel free to ping me at: myfirstname@lastname.se |
|
Added code & tests for deleting indexes, listing of indexes up next. #53 |
|
Added listing of indexes. #53 |
|
Fields for an index follows sort syntax. Same does fields specified for sort during a find. I created a serializable class named Indexfield. Wondering if that should be named as SortableField instead as it can be used both to specify index fields while creating them or sorting fields during a find. Thoughts? |
|
If both share the same contract, yes, if not then have two different classes. Yes, the samples environments is probably the only thing that should be in. |
|
Added nascent support for implicit query operators. Need to figure out a way of specifying $ operators with C# objects. #53 |
|
Or just make it string based as SearchExpression is for searches. Then we
|
|
Till I find a better way, this is it. Which is to find by raw json. Not satisfied with it as it shifts the onus of building a valid Json back to the consumer. #53 |
|
Added some code to illustrate use of a selector object to build selector expression. Code all clubbed into a single file. If deemed fit, can organize properly and augment for other operators. #53 . Feedback awaited. |
|
Sorry for going MIA. Maybe some fluent config or something? I'm thinking (in the future) of pulling out the LambdaExpression parser I had in SisoDB and allow e.g. |
|
I added code to illustrate a config approach using enums to represent On Wed, Sep 17, 2014 at 12:06 PM, Daniel Wertheim notifications@github.com
|
|
I had an unrelated question for you. Is it possible to index a document On Wed, Sep 17, 2014 at 12:06 PM, Daniel Wertheim notifications@github.com
|
|
In your map, just loop your nested array and emit "keys" from it. |
|
Okay, so it needs to be a map reduce view (without reduce) rather than an On Wed, Sep 17, 2014 at 12:28 PM, Daniel Wertheim notifications@github.com
|
|
Not sure if the query API has support for it.
|
|
Thx for the idea. Applied a similar approach to the index function. On Wed, Sep 17, 2014 at 2:06 PM, Daniel Wertheim notifications@github.com
|
|
Should I merge this in or is there work left? |
|
Unfortunately I've not been able to spend time on this since then. I think On Mon, Sep 22, 2014 at 12:22 PM, Daniel Wertheim notifications@github.com
|
|
Hi Daniel It's been a while that I've not been able to contribute to this due to Also, somehow, I don't quite find documentation of this endpoint in Regards On Tue, Sep 23, 2014 at 12:52 PM, Indranil Chatterjee <
|
|
Sorry, I didn't realize that the query code wasn't merged to develop yet. I've merged it to my develop fork. |
|
So this PR contains both queries and lists? I'll get to it during this weekend. |
|
This one does not contain lists. It contains queries (with string On Fri, Dec 12, 2014 at 1:57 AM, Daniel Wertheim notifications@github.com
|
|
Hi Daniel I've merged code for lists along with query for you to have a look at them Indranil On Fri, Dec 12, 2014 at 2:03 AM, Indranil Chatterjee <
|
|
Let me know if you were able to view the changes. I included list changes On Fri, Dec 12, 2014 at 11:17 AM, Indranil Chatterjee <
|
There was a problem hiding this comment.
Just verifying, ddoc is this correct?
There was a problem hiding this comment.
Yes. ddoc is the property name (
https://docs.cloudant.com/api/cloudant-query.html#list-all-indexes - this
lists the response body properties).
On Fri, Dec 19, 2014 at 2:54 AM, Daniel Wertheim notifications@github.com
wrote:
In source/projects/MyCouch.Cloudant.Net45/Responses/CloudantJsonScheme.cs
#54 (diff)
:@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MyCouch.Cloudant.Responses
+{
- public static class CloudantJsonScheme
- {
public const string DesignDoc = "ddoc";Just verifying, ddoc is this correct?
—
Reply to this email directly or view it on GitHub
https://github.com/danielwertheim/mycouch/pull/54/files#r22072432.
|
Comparing stuff and just making some minor changes. Looks nice. Haven't executed the tests yet. Are there test-cases for this? |
There was a problem hiding this comment.
Shall this only take one serializer? Should it not also take the "Document configured serialzer" for use in e.g. FindResponseFactory? Look at Searches and the SearchIndexResponseFactory.
You don't need to change. Just let me know.
There was a problem hiding this comment.
Actually, I need some clarity around where to use this over or in addition
to the other one.
Both of them get passed as ISerlaizer instances. Are they required for APIs
where we support strongly types entities in return (i.e. where we can use
MaterializeSuccessfulResponse with TIncludedDoc as something
other than string?
I was able to return a strongly typed entity in a test (the test
Query_can_skip_and_limit_results in the file QueryTests.cs does it.
I saw this getting used in generating requests where we serialize Json docs
into querystring parameters. Should we use it for find API (there are cases
where we use into Serializer.ToJson or ToJsonArray)?
On Fri, Dec 19, 2014 at 3:02 AM, Daniel Wertheim notifications@github.com
wrote:
In source/projects/MyCouch.Cloudant.Net45/Contexts/Queries.cs
#54 (diff)
:+using MyCouch.Serialization;
+using System.Net.Http;
+using System.Threading.Tasks;
+
+namespace MyCouch.Cloudant.Contexts
+{
- public class Queries : ApiContextBase, IQueries
- {
protected PostIndexHttpRequestFactory PostIndexHttpRequestFactory { get; set; }protected GetAllIndexesHttpRequestFactory GetAllIndexesHttpRequestFactory { get; set; }protected DeleteIndexHttpRequestFactory DeleteIndexHttpRequestFactory { get; set; }protected FindHttpRequestFactory FindHttpRequestFactory { get; set; }protected IndexResponseFactory IndexResponseFactory { get; set; }protected IndexListResponseFactory IndexListResponseFactory { get; set; }protected FindResponseFactory FindResponseFactory { get; set; }public Queries(IDbClientConnection connection, ISerializer serializer)Shall this only take one serializer? Should it not also take the "Document
configured serialzer" for use in e.g. FindResponseFactory? Look at
Searches and the SearchIndexResponseFactory.You don't need to change. Just let me know.
—
Reply to this email directly or view it on GitHub
https://github.com/danielwertheim/mycouch/pull/54/files#r22073017.
There was a problem hiding this comment.
The ISerializer that is configured as "DocumentSerializer" in bootstrapper, is used for serialization with entities where Id and Rev conventions apply.
There was an IDocumentSerializer before, but the plan is to just have one, and probably instead have specific methods in that serializer, e.g. SerializeEntity vs Serialize.
|
They should be under On Fri, Dec 19, 2014 at 2:55 AM, Daniel Wertheim notifications@github.com
|
|
Maybe I should move this to the CouchDBClient instead of Cloudant, as they have it open sourced for CouchDB https://github.com/cloudant/mango |
|
I've pushed a branch https://github.com/danielwertheim/mycouch/tree/feature/pr-queries-and-lists with this pull request merged. It will go in to develop. There are some |
|
I get a 404 when I click on the branch link. It also doesn't show up as a On Sat, Dec 20, 2014 at 4:36 PM, Daniel Wertheim notifications@github.com
|
|
I've already finished it and merged it back in develop. No worries. I'm rebuilding Lists a bit. Making it as an option on queries against Opinions?
|
|
Okay. Somehow, the latest changes to your develop branch doesn't get Lists always operate with views so that way it makes sense. But does it Answers to some of the TODO items: HttpRequest.cs: public virtual void SetAcceptHeader(string acceptHeader) QueryListHttpRequestFactory.cs (Create method): if(!string.IsNullOrWhiteSpace(request.ContentType)) Added a string property named ContentType in IListParameters (and On Sun, Dec 21, 2014 at 1:35 PM, Daniel Wertheim notifications@github.com
|
|
Will have to look into |
Added code to create a simple index with integration tests using Cloudant query API #53. Before adding more features, wanted to have a quick review of the components. We don't have querying yet. If okay, will add delete/listing of indices, followed by query.