Пример #1
0
        public IIndexNavigator Create(IndexNode node)
        {
            if (!pool.TryTake(out var navigator))
            {
                navigator = new IndexNavigator();
            }

            navigator.Initialize(node, this);
            return(navigator);
        }
Пример #2
0
        public void Return(IndexNavigator navigator)
        {
            if (this.pool.Count > 10)
            {
                return;
            }

            // TODO should there be any consideration to navigators that have had their
            // string build grown to a large size? Should they not be returned to the pool so they can be GCed?
            this.pool.Add(navigator);
        }
Пример #3
0
        public IIndexNavigator Create(IIndexSnapshot indexSnapshot)
        {
            var node = indexSnapshot.Root;

            if (!this.pool.TryTake(out var navigator))
            {
                navigator = new IndexNavigator();
            }

            navigator.Initialize(node, this, this.scorer.CreateIndexScorer(indexSnapshot));
            return(navigator);
        }