コード例 #1
0
ファイル: MultiReader.cs プロジェクト: ArsenShnurkov/beagle-1
        public MultiTermEnum(IndexReader[] readers, int[] starts, Term t)
        {
            queue = new SegmentMergeQueue(readers.Length);
            for (int i = 0; i < readers.Length; i++)
            {
                IndexReader reader = readers[i];
                TermEnum    termEnum;

                if (t != null)
                {
                    termEnum = reader.Terms(t);
                }
                else
                {
                    termEnum = reader.Terms();
                }

                SegmentMergeInfo smi = new SegmentMergeInfo(starts[i], termEnum, reader);
                if (t == null?smi.Next():termEnum.Term() != null)
                {
                    queue.Put(smi);
                }
                // initialize queue
                else
                {
                    smi.Close();
                }
            }

            if (t != null && queue.Size() > 0)
            {
                Next();
            }
        }
コード例 #2
0
        private void  MergeTerms()
        {
            try
            {
                freqOutput      = directory.CreateOutput(segment + ".frq");
                proxOutput      = directory.CreateOutput(segment + ".prx");
                termInfosWriter = new TermInfosWriter(directory, segment, fieldInfos, termIndexInterval);
                skipInterval    = termInfosWriter.skipInterval;
                maxSkipLevels   = termInfosWriter.maxSkipLevels;
                skipListWriter  = new DefaultSkipListWriter(skipInterval, maxSkipLevels, mergedDocs, freqOutput, proxOutput);
                queue           = new SegmentMergeQueue(readers.Count);

                MergeTermInfos();
            }
            finally
            {
                if (freqOutput != null)
                {
                    freqOutput.Close();
                }
                if (proxOutput != null)
                {
                    proxOutput.Close();
                }
                if (termInfosWriter != null)
                {
                    termInfosWriter.Close();
                }
                if (queue != null)
                {
                    queue.Close();
                }
            }
        }
コード例 #3
0
        private void  MergeTerms()
        {
            SegmentWriteState state = new SegmentWriteState(null, directory, segment, null, mergedDocs, 0, termIndexInterval);

            FormatPostingsFieldsConsumer consumer = new FormatPostingsFieldsWriter(state, fieldInfos);

            try
            {
                queue = new SegmentMergeQueue(readers.Count);

                MergeTermInfos(consumer);
            }
            finally
            {
                consumer.Finish();
                if (queue != null)
                {
                    queue.Dispose();
                }
            }
        }
コード例 #4
0
ファイル: SegmentMerger.cs プロジェクト: Rationalle/ravendb
		private void  MergeTerms()
		{
			
			SegmentWriteState state = new SegmentWriteState(null, directory, segment, null, mergedDocs, 0, termIndexInterval);
			
			FormatPostingsFieldsConsumer consumer = new FormatPostingsFieldsWriter(state, fieldInfos);
			
			try
			{
				queue = new SegmentMergeQueue(readers.Count);
				
				MergeTermInfos(consumer);
			}
			finally
			{
				consumer.Finish();
				if (queue != null)
					queue.Close();
			}
		}
コード例 #5
0
ファイル: MultiReader.cs プロジェクト: zweib730/beagrep
		public MultiTermEnum(IndexReader[] readers, int[] starts, Term t)
		{
			queue = new SegmentMergeQueue(readers.Length);
			for (int i = 0; i < readers.Length; i++)
			{
				IndexReader reader = readers[i];
				TermEnum termEnum;
				
				if (t != null)
				{
					termEnum = reader.Terms(t);
				}
				else
					termEnum = reader.Terms();
				
				SegmentMergeInfo smi = new SegmentMergeInfo(starts[i], termEnum, reader);
				if (t == null?smi.Next():termEnum.Term() != null)
					queue.Put(smi);
				// initialize queue
				else
					smi.Close();
			}
			
			if (t != null && queue.Size() > 0)
			{
				Next();
			}
		}
コード例 #6
0
            internal SegmentMergeInfo[] matchingSegments; // null terminated array of matching segments
            
            public MultiTermEnum(IndexReader topReader, IndexReader[] readers, int[] starts, Term t)
            {
                this.topReader = topReader;
                queue = new SegmentMergeQueue(readers.Length);
                matchingSegments = new SegmentMergeInfo[readers.Length + 1];
                for (int i = 0; i < readers.Length; i++)
                {
                    IndexReader reader = readers[i];

                	TermEnum termEnum = t != null ? reader.Terms(t) : reader.Terms();

                	var smi = new SegmentMergeInfo(starts[i], termEnum, reader) {ord = i};
                	if (t == null?smi.Next():termEnum.Term != null)
                        queue.Add(smi);
                    // initialize queue
                    else
                        smi.Dispose();
                }
                
                if (t != null && queue.Size() > 0)
                {
                    Next();
                }
            }
コード例 #7
0
        private void MergeTerms()
        {
            try
            {
                freqOutput = directory.CreateOutput(segment + ".frq");
                proxOutput = directory.CreateOutput(segment + ".prx");
                termInfosWriter = new TermInfosWriter(directory, segment, fieldInfos, termIndexInterval);
                skipInterval = termInfosWriter.skipInterval;
                queue = new SegmentMergeQueue(readers.Count);

                MergeTermInfos();
            }
            finally
            {
                if (freqOutput != null)
                    freqOutput.Close();
                if (proxOutput != null)
                    proxOutput.Close();
                if (termInfosWriter != null)
                    termInfosWriter.Close();
                if (queue != null)
                    queue.Close();
            }
        }
コード例 #8
0
        private void MergeTerms()
        {
            try
            {
                freqOutput = directory.CreateOutput(segment + ".frq");
                if (HasProx())
                    proxOutput = directory.CreateOutput(segment + ".prx");
                termInfosWriter = new TermInfosWriter(directory, segment, fieldInfos, termIndexInterval);
                skipInterval = termInfosWriter.skipInterval;
                maxSkipLevels = termInfosWriter.maxSkipLevels;
                skipListWriter = new DefaultSkipListWriter(skipInterval, maxSkipLevels, mergedDocs, freqOutput, proxOutput);
                queue = new SegmentMergeQueue(readers.Count);

                MergeTermInfos();
            }
            finally
            {
                if (freqOutput != null)
                    freqOutput.Close();
                if (proxOutput != null)
                    proxOutput.Close();
                if (termInfosWriter != null)
                    termInfosWriter.Close();
                if (queue != null)
                    queue.Close();
            }
        }