コード例 #1
0
        // TODO: broadcastNodeExpire?  then we can purge the
        // known-stale cache entries...

        // MOCK: in a real env you have to hit the wire
        // (send this query to all remote nodes
        // concurrently):
        internal virtual TopDocs SearchNode(int nodeID, long[] nodeVersions, Query q, Sort sort, int numHits, ScoreDoc searchAfter)
        {
            NodeState.ShardIndexSearcher s = m_nodes[nodeID].Acquire(nodeVersions);
            try
            {
                if (sort is null)
                {
                    if (searchAfter != null)
                    {
                        return(s.LocalSearchAfter(searchAfter, q, numHits));
                    }
                    else
                    {
                        return(s.LocalSearch(q, numHits));
                    }
                }
                else
                {
                    if (Debugging.AssertsEnabled)
                    {
                        Debugging.Assert(searchAfter is null);                           // not supported yet
                    }
                    return(s.LocalSearch(q, numHits, sort));
                }
            }
            finally
            {
                NodeState.Release(s); // LUCENENET: made static per CA1822 and eliminated array lookup
            }
        }
コード例 #2
0
        // TODO: broadcastNodeExpire?  then we can purge the
        // known-stale cache entries...

        // MOCK: in a real env you have to hit the wire
        // (send this query to all remote nodes
        // concurrently):
        internal virtual TopDocs SearchNode(int nodeID, long[] nodeVersions, Query q, Sort sort, int numHits, ScoreDoc searchAfter)
        {
            NodeState.ShardIndexSearcher s = m_nodes[nodeID].Acquire(nodeVersions);
            try
            {
                if (sort == null)
                {
                    if (searchAfter != null)
                    {
                        return(s.LocalSearchAfter(searchAfter, q, numHits));
                    }
                    else
                    {
                        return(s.LocalSearch(q, numHits));
                    }
                }
                else
                {
                    Debug.Assert(searchAfter == null); // not supported yet
                    return(s.LocalSearch(q, numHits, sort));
                }
            }
            finally
            {
                m_nodes[nodeID].Release(s);
            }
        }