Example #1
0
        public void Init()
        {
            facetHandlers = new List <IFacetHandler>();

            directory           = new RAMDirectory();
            analyzer            = new WhitespaceAnalyzer();
            selectionProperties = new Dictionary <string, string>();
            IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);

            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop5=val1"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val1", "prop7=val7"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val2", "prop3=val3"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop4=val2", "prop4=val3"));
            writer.Commit();

            attributesFacetHandler = new AttributesFacetHandler(AttributeHandlerName, AttributeHandlerName, null, null,
                                                                new Dictionary <string, string>());
            facetHandlers.Add(attributesFacetHandler);
            IndexReader reader = IndexReader.Open(directory, true);

            boboReader = BoboIndexReader.GetInstance(reader, facetHandlers);
            attributesFacetHandler.LoadFacetData(boboReader);
            browser = new BoboBrowser(boboReader);
        }
        public void Init()
        {
            facetHandlers = new List<IFacetHandler>();

            directory = new RAMDirectory();
            analyzer = new WhitespaceAnalyzer();
            selectionProperties = new Dictionary<string, string>();
            IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);

            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop5=val1"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val1", "prop7=val7"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val2", "prop3=val3"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop4=val2", "prop4=val3"));
            writer.Commit();

            attributesFacetHandler = new AttributesFacetHandler(AttributeHandlerName, AttributeHandlerName, null, null,
                new Dictionary<string, string>());
            facetHandlers.Add(attributesFacetHandler);
            IndexReader reader = IndexReader.Open(directory, true);
            boboReader = BoboIndexReader.GetInstance(reader, facetHandlers);
            attributesFacetHandler.LoadFacetData(boboReader);
            browser = new BoboBrowser(boboReader);
        }
Example #3
0
        private void ModifiedSetup()
        {
            directory = new RAMDirectory();
            analyzer  = new WhitespaceAnalyzer();
            IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);

            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop5=val1"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val1", "prop7=val7"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val2", "prop3=val3"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop4=val2", "prop4=val3"));
            writer.Commit();

            IDictionary <string, string> facetProps = new Dictionary <string, string>();

            facetProps.Put(AttributesFacetHandler.MAX_FACETS_PER_KEY_PROP_NAME, "1");
            attributesFacetHandler = new AttributesFacetHandler(AttributeHandlerName, AttributeHandlerName, null, null,
                                                                facetProps);
            facetHandlers.Add(attributesFacetHandler);
            IndexReader reader = IndexReader.Open(directory, true);

            boboReader = BoboIndexReader.GetInstance(reader, facetHandlers);
            attributesFacetHandler.LoadFacetData(boboReader);
            browser = new BoboBrowser(boboReader);
        }
        public void Init()
        {
            facetHandlers = new List <IFacetHandler>();

            directory           = new RAMDirectory();
            analyzer            = new WhitespaceAnalyzer(LuceneVersion.LUCENE_48);
            selectionProperties = new Dictionary <string, string>();
            IndexWriterConfig conf = new IndexWriterConfig(LuceneVersion.LUCENE_48, analyzer);

            conf.SetOpenMode(OpenMode.CREATE);
            IndexWriter writer = new IndexWriter(directory, conf);

            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop5=val1"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val1", "prop7=val7"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val2", "prop3=val3"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop4=val2", "prop4=val3"));
            writer.Commit();

            attributesFacetHandler = new AttributesFacetHandler(AttributeHandlerName, AttributeHandlerName,
                                                                null, null, new Dictionary <string, string>());
            facetHandlers.Add(attributesFacetHandler);
            DirectoryReader reader = DirectoryReader.Open(directory);

            boboReader = BoboMultiReader.GetInstance(reader, facetHandlers);
            foreach (BoboSegmentReader subReader in boboReader.GetSubReaders())
            {
                attributesFacetHandler.LoadFacetData(subReader);
            }
            browser = new BoboBrowser(boboReader);
        }
        private void ModifiedSetup()
        {
            directory = new RAMDirectory();
            analyzer  = new WhitespaceAnalyzer(LuceneVersion.LUCENE_48);
            IndexWriterConfig conf = new IndexWriterConfig(LuceneVersion.LUCENE_48, analyzer);

            conf.SetOpenMode(OpenMode.CREATE);
            IndexWriter writer = new IndexWriter(directory, conf);

            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop5=val1"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val1", "prop7=val7"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val2", "prop3=val3"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop4=val2", "prop4=val3"));
            writer.Commit();

            IDictionary <string, string> facetProps = new Dictionary <string, string>();

            facetProps.Put(AttributesFacetHandler.MAX_FACETS_PER_KEY_PROP_NAME, "1");
            attributesFacetHandler = new AttributesFacetHandler(AttributeHandlerName, AttributeHandlerName,
                                                                null, null, facetProps);
            facetHandlers.Add(attributesFacetHandler);
            DirectoryReader reader = DirectoryReader.Open(directory);

            boboReader = BoboMultiReader.GetInstance(reader, facetHandlers);
            foreach (BoboSegmentReader subReader in boboReader.GetSubReaders())
            {
                attributesFacetHandler.LoadFacetData(subReader);
            }
            browser = new BoboBrowser(boboReader);
        }
 public AttributesFacetCountCollector(AttributesFacetHandler attributesFacetHandler, string name, MultiValueFacetDataCache dataCache, int docBase, BrowseSelection browseSelection, FacetSpec ospec, int numFacetsPerKey, char separator)
     : base(name, dataCache, docBase, browseSelection, ospec)
 {
     this.attributesFacetHandler = attributesFacetHandler;
     this.dataCache = dataCache;
     this.numFacetsPerKey = numFacetsPerKey;
     this.separator = separator;
     //_array = dataCache.NestedArray; // NOT USED
     if (browseSelection != null)
     {
         values = browseSelection.Values;
     }
 }
 public AttributesFacetCountCollector(AttributesFacetHandler attributesFacetHandler, string name, MultiValueFacetDataCache dataCache, int docBase, BrowseSelection browseSelection, FacetSpec ospec, int numFacetsPerKey, char separator)
     : base(name, dataCache, docBase, browseSelection, ospec)
 {
     this.attributesFacetHandler = attributesFacetHandler;
     this.dataCache       = dataCache;
     this.numFacetsPerKey = numFacetsPerKey;
     this.separator       = separator;
     //_array = dataCache.NestedArray; // NOT USED
     if (browseSelection != null)
     {
         values = browseSelection.Values;
     }
 }
Example #8
0
 public AttributesFacetCountCollectorSource(AttributesFacetHandler parent, BrowseSelection browseSelection, FacetSpec ospec)
 {
     _parent          = parent;
     _browseSelection = browseSelection;
     _ospec           = ospec;
 }
 public AttributesFacetCountCollectorSource(AttributesFacetHandler parent, BrowseSelection browseSelection, FacetSpec ospec)
 {
     _parent = parent;
     _browseSelection = browseSelection;
     _ospec = ospec;
 }
        private void ModifiedSetup()
        {
            directory = new RAMDirectory();
            analyzer = new WhitespaceAnalyzer();
            IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);

            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop5=val1"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val1", "prop7=val7"));
            writer.AddDocument(Doc("prop1=val2", "prop3=val2", "prop3=val3"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1"));
            writer.AddDocument(Doc("prop1=val1", "prop2=val1", "prop4=val2", "prop4=val3"));
            writer.Commit();

            IDictionary<string, string> facetProps = new Dictionary<string, string>();
            facetProps.Put(AttributesFacetHandler.MAX_FACETS_PER_KEY_PROP_NAME, "1");
            attributesFacetHandler = new AttributesFacetHandler(AttributeHandlerName, AttributeHandlerName, null, null,
                facetProps);
            facetHandlers.Add(attributesFacetHandler);
            IndexReader reader = IndexReader.Open(directory, true);
            boboReader = BoboIndexReader.GetInstance(reader, facetHandlers);
            attributesFacetHandler.LoadFacetData(boboReader);
            browser = new BoboBrowser(boboReader);
        }