You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apply document filters to DocumentSet<T> at query time (#378)
Motivation
----------
Some forms of querying using `DocumentSet<T>` properties on an inherited
`BucketContext` don't apply document filters such as the `DocumentType`
attribute.
Modifications
-------------
- Split `CollectionQueryable<T>` into two types `CollectionQueryable<T>`
and a base `CouchbaseQueryable<T>`. The former is used to represent
the original extent of a query against a collection. The latter is
used to construct new `IQueryable<T>` instances as the query is
extended with predicates, etc. This removes unnecessary fields and
logic from the simpler case that is repeated for every new LINQ method
applied to the query.
- Add an additional non-generic `IDocumentSet` interface which is
inherited by `IDocumentSet<T>`. This is a SemVer safe change because
it only adds `IQueryable` which was already included on
`IDocumentSet<T>` via `IQueryable<T>`.
- Create DelayedFilterQueryProvider as a wrapper for
ClusterQueryProvider that applies filters to `IDocumentSet` at query
execution time.
- Refactor query timeouts to always be based on a callback to the
`BucketContext` rather than a property, which allows a singleton
`ClusterQueryExecutor` per `BucketContext` rather than per query.
- Refactor `BucketContext` to build a singleton query provider, query
parser, and query executor rather than recreating for every query.
- Refactor `DocumentSet<T>` to get the query provider from the
`BucketContext`.
- Reduce interface invocations by caching the bucket, scope, and
collection names once when constructing a `DocumentSet<T>` or
`CollectionQueryable<T>` instead of for each property read.
- Minor perf and nullable ref type improvements to `DocumentFilterSet`.
- Fix some integration tests that were refering to data no longer found
in the default `beer-sample` bucket.
Results
-------
Filters are applied consistently to `DocumentSet<T>` based on the
filter configuration at the time the query is run. Queries in all cases
will have fewer heap allocations and other CPU performance benefits.
Resolves#376
@@ -42,6 +37,16 @@ public BucketContext(IBucket bucket)
42
37
$"{nameof(DocumentFilterManager)} has not been registered with the Couchbase Cluster. Be sure {nameof(LinqClusterOptionsExtensions.AddLinq)} is called on ${nameof(ClusterOptions)} during bootstrap.");
0 commit comments