/// <summary> /// Execute query and return generic resultset /// </summary> /// <returns>Generic resultset</returns> public CouchLuceneGenericViewResult GetResult() { try { return(GetResult <CouchLuceneGenericViewResult>()); } catch (WebException e) { throw CouchException.Create("Query failed", e); } }
public override T GetResult <T>() { if (Options["q"] == null) { throw CouchException.Create("Lucene query failed, you need to specify Q(<Lucene-query-string>)."); } var req = Request(); Result = new T(); JObject json = req.Parse(); Result.Result(json, View); return((T)Result); }
public override T GetResult <T>() { if (Options["q"] == null) { throw CouchException.Create("Lucene query failed, you need to specify Q(<Lucene-query-string>)."); } var req = Request(); if (Result == null) { Result = new T(); } else { // Tell the request what we already have req.Etag(Result.etag); if (CheckETag) { // Make a HEAD request to avoid transfer of data if (req.Head().Send().IsETagValid()) { return((T)Result); } // Set back to GET before proceeding below req.Get(); } } JObject json = req.Parse(); if (json != null) // ETag did not match, view has changed { Result.Result(json, View); Result.etag = req.Etag(); } return((T)Result); }