public LuceneIndexFactory(IIndexStorage storage) { this.storage = storage; A.CallTo(() => grainFactory.GetGrain <ILuceneTextIndexGrain>(A <Guid> ._, null)) .ReturnsLazily(() => grain); }
public CrawlerService(IIndexingQueue queue, IScrapperService scrapperService, IIndexStorage indexStorage, IConfiguration configuration) { _queue = queue; _scrapperService = scrapperService; _indexStorage = indexStorage; _configuration = configuration; _sameDomain = configuration.GetValue <bool>("SameDomain"); }
public IndexManager(IIndexStorage directoryFactory, ISemanticLog log) { Guard.NotNull(directoryFactory); Guard.NotNull(log); this.directoryFactory = directoryFactory; this.log = log; }
public IndexManager(IIndexStorage indexStorage, ISemanticLog log) { Guard.NotNull(indexStorage); Guard.NotNull(log); this.indexStorage = indexStorage; this.log = log; }
public LuceneStorageIndex(IIndexConfiguration configuration = null, IIndexStorage storage = null, IServiceFactory factory = null, Analyzer analyzer = null) { //TODO: Version should come from outside Version = Version.LUCENE_30; Factory = factory ?? new DefaultServiceFactory(); Schemas = Factory.CreateSchemaCollection(this); writer = new Lazy <ILuceneWriter>(() => new LuceneWriter(this, Factory.CreateDocumentFactory(this))); searcher = new Lazy <ILuceneSearcher>(() => Factory.CreateSearcher(this)); Analyzer = analyzer ?? new DotJemAnalyzer(Version.LUCENE_30, configuration); Storage = storage ?? new LuceneMemmoryIndexStorage(); Configuration = configuration ?? new IndexConfiguration(); }
private async Task IndexAndSearchAsync(IIndexStorage storage) { var factory = new IndexManager(storage, A.Fake <ISemanticLog>()); var grain = new LuceneTextIndexGrain(factory); await grain.ActivateAsync(appId.Id); var elapsed1 = await IndexAsync(grain); var elapsed2 = await SearchAsync(grain); var elapsed3 = await SearchAsync(grain); Assert.Equal(new long[0], new[] { elapsed1, elapsed2, elapsed3 }); }
private async Task IndexAndSearchAsync(IIndexStorage storage) { var schemaId = NamedId.Of(Guid.NewGuid(), "my-schema"); var factory = new IndexManager(storage, new NoopLog()); var grain = new LuceneTextIndexGrain(factory); await grain.ActivateAsync(Guid.NewGuid()); for (var i = 0; i < M; i++) { var ids = new Guid[N]; for (var j = 0; j < ids.Length; j++) { ids[j] = Guid.NewGuid(); } foreach (var id in ids) { var commands = new IndexCommand[] { new UpsertIndexEntry { ContentId = id, DocId = id.ToString(), ServeAll = true, ServePublished = true, Texts = texts } }; await grain.IndexAsync(schemaId, commands.AsImmutable()); } await grain.CommitAsync(); } }
public SearchService(IIndexStorage indexStorage) { _indexStorage = indexStorage; }
public LuceneStorageIndex(IIndexStorage storage, Analyzer analyzer = null) : this(new IndexConfiguration(), storage, analyzer : analyzer) { }