Esempio n. 1
0
            internal void LoadNextValue(LeafReaderContext context, int docID)
            {
                NumericDocValues docValues;

                if (DocValuesCache.ContainsKey(context))
                {
                    docValues = DocValuesCache[context];
                }
                else
                {
                    try
                    {
                        docValues = context.reader().getNumericDocValues(Field);
                        DocValuesCache[context] = docValues;
                    }
                    catch (IOException e)
                    {
                        throw new Exception(e);
                    }
                }
                if (docValues != null)
                {
                    CurrentValue = docValues.get(docID);
                }
                else
                {
                    CurrentValue = -1;
                }
            }
Esempio n. 2
0
 internal MatchingDocs(LeafReaderContext context, DocIdSet docIdSet, int totalHits, float[] scores)
 {
     this.Context   = context;
     this.DocIdSet  = docIdSet;
     this.TotalHits = totalHits;
     this.Scores    = scores;
 }
Esempio n. 3
0
 protected internal override void onNextDoc(int localDocID, LeafReaderContext context)
 {
     _outerInstance.readerCache.Clear();
     _outerInstance.currentContext = context;
     _outerInstance.currentDocID   = localDocID;
     outerInstance.LoadNextValue(context, localDocID);
 }
Esempio n. 4
0
        private static LeafReaderContext[] GetLeafReaderContexts(IList <MatchingDocs> matchingDocs)
        {
            int segments = matchingDocs.Count;

            LeafReaderContext[] contexts = new LeafReaderContext[segments];
            for (int i = 0; i < segments; i++)
            {
                MatchingDocs matchingDoc = matchingDocs[i];
                contexts[i] = matchingDoc.Context;
            }
            return(contexts);
        }
Esempio n. 5
0
        /// <returns> the documents matched by the query, one <seealso cref="MatchingDocs"/> per visited segment that contains a hit. </returns>
        public virtual IList <MatchingDocs> GetMatchingDocs()
        {
            if (_docs != null && _segmentHits > 0)
            {
                CreateMatchingDocs();
                _docs    = null;
                _scores  = null;
                _context = null;
            }

            return(Collections.unmodifiableList(_matchingDocs));
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static java.util.Set<String> getFieldNamesToSample(org.apache.lucene.index.LeafReaderContext readerContext) throws java.io.IOException
        private static ISet <string> GetFieldNamesToSample(LeafReaderContext readerContext)
        {
            Fields        fields     = readerContext.reader().fields();
            ISet <string> fieldNames = new HashSet <string>();

            foreach (string field in fields)
            {
                if (!LuceneDocumentStructure.NODE_ID_KEY.Equals(field))
                {
                    fieldNames.Add(field);
                }
            }
            return(fieldNames);
        }
Esempio n. 7
0
            protected internal override ScoreDoc FetchNextOrNull()
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                if (!Iterator.hasNext())
                {
                    return(null);
                }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                CurrentDocConflict = Iterator.next();
                int subIndex = ReaderUtil.subIndex(CurrentDocConflict.doc, DocStarts);
                LeafReaderContext context = Contexts[subIndex];

                OnNextDoc(CurrentDocConflict.doc - context.docBase, context);
                return(CurrentDocConflict);
            }
Esempio n. 8
0
            internal ScoreDocsIterator(TopDocs docs, LeafReaderContext[] contexts)
            {
                this.Contexts = contexts;
                this.Iterator = new ArrayIterator <ScoreDoc>(docs.scoreDocs);
                int segments = contexts.Length;

                DocStarts = new int[segments + 1];
                for (int i = 0; i < segments; i++)
                {
                    LeafReaderContext context = contexts[i];
                    DocStarts[i] = context.docBase;
                }
                LeafReaderContext lastContext = contexts[segments - 1];

                DocStarts[segments] = lastContext.docBase + lastContext.reader().maxDoc();
            }
Esempio n. 9
0
        public override void DoSetNextReader(LeafReaderContext context)
        {
            if (_docs != null && _segmentHits > 0)
            {
                CreateMatchingDocs();
            }
            int maxDoc = context.reader().maxDoc();

            _docs = CreateDocs(maxDoc);
            if (_keepScores)
            {
                int initialSize = Math.Min(32, maxDoc);
                _scores = new float[initialSize];
            }
            _segmentHits  = 0;
            this._context = context;
        }
Esempio n. 10
0
 protected internal override void DoSetNextReader(LeafReaderContext context)
 {
     this._reader = context.reader();
 }
Esempio n. 11
0
 protected internal override void onNextDoc(int localDocID, LeafReaderContext context)
 {
     outerInstance.UpdateCurrentDocument(localDocID, context.reader());
 }
Esempio n. 12
0
 protected internal abstract void OnNextDoc(int localDocID, LeafReaderContext context);