public static QuerySpec RemoveLimit(this QuerySpec querySpec, SmartStore store) { if (string.IsNullOrWhiteSpace(querySpec.SoupName) == false && store.HasSoup(querySpec.SoupName) == false) { return(querySpec); } var count = (int)store.CountQuery(querySpec); switch (querySpec.QueryType) { case QuerySpec.SmartQueryType.Exact: return(QuerySpec.BuildExactQuerySpec(querySpec.SoupName, querySpec.Path, querySpec.MatchKey, count)); case QuerySpec.SmartQueryType.Like: return(QuerySpec.BuildLikeQuerySpec(querySpec.SoupName, querySpec.Path, querySpec.LikeKey, querySpec.Order, count)); case QuerySpec.SmartQueryType.Range: return(QuerySpec.BuildRangeQuerySpec(querySpec.SoupName, querySpec.Path, querySpec.BeginKey, querySpec.EndKey, querySpec.Order, count)); default: case QuerySpec.SmartQueryType.Smart: return(QuerySpec.BuildSmartQuerySpec(querySpec.SmartSql, count)); } }
public JArray Query(string smartSql) { JArray result = null; QuerySpec querySpec = QuerySpec.BuildSmartQuerySpec(smartSql, 10); var count = (int)_store.CountQuery(querySpec); querySpec = QuerySpec.BuildSmartQuerySpec(smartSql, count); try { result = _store.Query(querySpec, 0); } catch (SmartStoreException e) { Debug.WriteLine("Error occurred while attempting to run query. Please verify validity of the query."); } return(result); }