public BloomFilteredFieldsConsumer(BloomFilteringPostingsFormat outerInstance, FieldsConsumer fieldsConsumer,
                                    SegmentWriteState state)
 {
     this.outerInstance      = outerInstance;
     _delegateFieldsConsumer = fieldsConsumer;
     _state = state;
 }
Exemple #2
0
 public BloomFilteredFieldsConsumer(FieldsConsumer fieldsConsumer,
                                    SegmentWriteState state, BloomFilteringPostingsFormat bfpf)
 {
     _delegateFieldsConsumer = fieldsConsumer;
     _state = state;
     _bfpf  = bfpf;
 }
            public BloomFilteredFieldsProducer(BloomFilteringPostingsFormat outerInstance, SegmentReadState state)
            {
                this.outerInstance = outerInstance;
                var bloomFileName = IndexFileNames.SegmentFileName(
                    state.SegmentInfo.Name, state.SegmentSuffix, BLOOM_EXTENSION);
                ChecksumIndexInput bloomIn = null;
                var success = false;

                try
                {
                    bloomIn = state.Directory.OpenChecksumInput(bloomFileName, state.Context);
                    var version = CodecUtil.CheckHeader(bloomIn, /*BLOOM_CODEC_NAME*/ outerInstance.Name, VERSION_START, VERSION_CURRENT);
                    // Load the hash function used in the BloomFilter
                    // hashFunction = HashFunction.forName(bloomIn.readString());
                    // Load the delegate postings format
                    var delegatePostingsFormat = ForName(bloomIn.ReadString());

                    _delegateFieldsProducer = delegatePostingsFormat
                                              .FieldsProducer(state);
                    var numBlooms = bloomIn.ReadInt32();
                    for (var i = 0; i < numBlooms; i++)
                    {
                        var fieldNum  = bloomIn.ReadInt32();
                        var bloom     = FuzzySet.Deserialize(bloomIn);
                        var fieldInfo = state.FieldInfos.FieldInfo(fieldNum);
                        _bloomsByFieldName.Add(fieldInfo.Name, bloom);
                    }

                    if (version >= VERSION_CHECKSUM)
                    {
                        CodecUtil.CheckFooter(bloomIn);
                    }
                    else
                    {
#pragma warning disable 612, 618
                        CodecUtil.CheckEOF(bloomIn);
#pragma warning restore 612, 618
                    }

                    IOUtils.Dispose(bloomIn);
                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        IOUtils.DisposeWhileHandlingException(bloomIn, _delegateFieldsProducer);
                    }
                }
            }
 public TestBloomFilteredLucene41Postings()
     : base("TestBloomFilteredLucene41Postings")
 {
     @delegate = new BloomFilteringPostingsFormat(new Lucene41PostingsFormat(),
                                                  new LowMemoryBloomFactory());
 }
 public BloomFilteredFieldsConsumer(FieldsConsumer fieldsConsumer,
     SegmentWriteState state, BloomFilteringPostingsFormat bfpf)
 {
     _delegateFieldsConsumer = fieldsConsumer;
     _state = state;
     _bfpf = bfpf;
 }
 public TestBloomFilteredLucene41Postings()
         : base("TestBloomFilteredLucene41Postings")
 {
     @delegate = new BloomFilteringPostingsFormat(new Lucene41PostingsFormat(),
         new LowMemoryBloomFactory());
 }