internal override IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { // find first indexNode var node = indexer.Find(index, _value, true, Query.Ascending); var str = _value.AsString; // navigate using next[0] do next node - if less or equals returns while (node != null) { var valueString = node.Key.AsString; // value will not be null because null occurs before string (bsontype sort order) if (valueString.StartsWith(str)) { if (!node.DataBlock.IsEmpty) { yield return(node); } } else { break; // if no more starts with, stop scanning } node = indexer.GetNode(node.Next[0]); } }
internal override IEnumerable <IndexNode> Run(CollectionPage col, IndexService indexer) { this.UseIndex = false; this.UseFilter = true; return(Query.All().Run(col, indexer)); }
public CollectionService(PageService pager, IndexService indexer, DataService data, TransactionService trans, Logger log) { _pager = pager; _indexer = indexer; _data = data; _trans = trans; _log = log; }
internal override IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { foreach (var value in _values.Distinct()) { foreach (var node in Query.EQ(this.Field, value).ExecuteIndex(indexer, index)) { yield return(node); } } }
/// <summary> /// Create instances for all engine services /// </summary> private void InitializeServices() { _cache = new CacheService(_disk, _log); _locker = new LockService(_disk, _cache, _timeout, _log); _pager = new PageService(_disk, _crypto, _cache, _log); _indexer = new IndexService(_pager, _log); _data = new DataService(_pager, _log); _trans = new TransactionService(_disk, _crypto, _pager, _locker, _cache, _cacheSize, _log); _collections = new CollectionService(_pager, _indexer, _data, _trans, _log); }
internal override IEnumerable <IndexNode> Run(CollectionPage col, IndexService indexer) { var left = _left.Run(col, indexer); var right = _right.Run(col, indexer); // if any query (left/right) is FullScan, this query is full scan too this.UseIndex = _left.UseIndex && _right.UseIndex; this.UseFilter = _left.UseFilter || _right.UseFilter; return(left.Union(right, new IndexNodeComparer())); }
internal override IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { // define order var order = _start.CompareTo(_end) <= 0 ? Query.Ascending : Query.Descending; // find first indexNode var node = indexer.Find(index, _start, true, order); // returns (or not) equals start value while (node != null) { var diff = node.Key.CompareTo(_start); // if current value are not equals start, go out this loop if (diff != 0) { break; } if (_startEquals) { yield return(node); } node = indexer.GetNode(node.NextPrev(0, order)); } // navigate using next[0] do next node - if less or equals returns while (node != null) { var diff = node.Key.CompareTo(_end); if (_endEquals && diff == 0) { yield return(node); } else if (diff == -order) { yield return(node); } else { break; } node = indexer.GetNode(node.NextPrev(0, order)); } }
internal override IEnumerable <IndexNode> Run(CollectionPage col, IndexService indexer) { // run base query var result = _query.Run(col, indexer); this.UseIndex = _query.UseIndex; this.UseFilter = _query.UseFilter; if (_query.UseIndex) { // if is by index, resolve here var all = new QueryAll("_id", _order).Run(col, indexer); return(all.Except(result, new IndexNodeComparer())); } else { // if is by document, must return all nodes to be ExecuteDocument after return(result); } }
internal override IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { foreach (var node in indexer.FindAll(index, Query.Ascending)) { // compares only with are same type if (node.Key.Type == _value.Type || (node.Key.IsNumber && _value.IsNumber)) { var diff = node.Key.CompareTo(_value); if (diff == 1 || (!_equals && diff == 0)) { break; } if (node.IsHeadTail(index)) { yield break; } yield return(node); } } }
internal override IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { throw new NotSupportedException(); }
internal override IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { return(indexer .FindAll(index, Query.Ascending) .Where(x => x.Key.IsString && x.Key.AsString.Contains(_value))); }
internal override IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { return(indexer .FindAll(index, _order) .Where(i => _func(i.Key))); }
/// <summary> /// Abstract method that must be implement for index seek/scan - Returns IndexNodes that match with index /// </summary> internal abstract IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index);
internal override IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { yield break; }
internal override IEnumerable <IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { return(indexer .FindAll(index, Query.Ascending) .Where(x => x.Key.CompareTo(_value) != 0)); }