Exemplo n.º 1
0
        public IIndexNavigator Create(IndexNode node)
        {
            if (!pool.TryTake(out var navigator))
            {
                navigator = new IndexNavigator();
            }

            navigator.Initialize(node, this);
            return(navigator);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }