Exemplo n.º 1
0
 public void WhenLoadingLotsOfDataShouldNotError()
 {
     foreach (var entry in WikipediaDataLoader.Load(this.GetType()))
     {
         this.index.Index(entry.name, entry.text);
     }
 }
Exemplo n.º 2
0
        public async Task InitializeAsync()
        {
            this.index = new FullTextIndexBuilder <string>().Build();
            var wikipediaTests = WikipediaDataLoader.Load(typeof(FullTextIndexTests));
            var options        = new TokenizationOptionsBuilder().XmlContent().WithStemming().Build();

            foreach (var(name, text) in wikipediaTests)
            {
                await this.index.AddAsync(name, text, options);
            }
        }
Exemplo n.º 3
0
        public static async Task RunAsync()
        {
            var index = new FullTextIndexBuilder <string>()
                        .WithDefaultTokenizationOptions(o => o.WithStemming().XmlContent())
                        .Build();

            var wikipediaTests = WikipediaDataLoader.Load(typeof(WikipediaSample));

            foreach (var(name, text) in wikipediaTests)
            {
                await index.AddAsync(name, text);
            }
        }
Exemplo n.º 4
0
        private async Task <IList <(string name, string text)> > PopulateIndexWithWikipediaData()
        {
            var wikipediaTests = WikipediaDataLoader.Load(this.GetType());

            this.index.BeginBatchChange();
            foreach (var(name, text) in wikipediaTests)
            {
                await this.index.AddAsync(name, text);
            }

            await this.index.CommitBatchChangeAsync();

            return(wikipediaTests);
        }
Exemplo n.º 5
0
        public async Task WhenLoadingLotsOfDataShouldNotError()
        {
            var wikipediaTests = WikipediaDataLoader.Load(this.GetType());

            this.index.BeginBatchChange();
            foreach (var(name, text) in wikipediaTests)
            {
                await this.index.AddAsync(name, text);
            }

            await this.index.CommitBatchChangeAsync();

            await this.index.RemoveAsync(wikipediaTests[10].name);

            await this.index.RemoveAsync(wikipediaTests[9].name);

            await this.index.RemoveAsync(wikipediaTests[8].name);
        }
Exemplo n.º 6
0
        private async Task <FullTextIndex <string> > CreateWikipediaIndexAsync()
        {
            var index = new FullTextIndexBuilder <string>()
                        .WithTextExtractor <XmlTextExtractor>()
                        .WithDefaultTokenization(o => o.WithStemming())
                        .Build();

            var wikipediaTests = WikipediaDataLoader.Load(typeof(FullTextIndexTests));

            foreach (var(name, text) in wikipediaTests)
            {
                await index.AddAsync(name, text);
            }

            // For good measure, index some surrogate pairs
            await index.AddAsync("Emoji", "Emojis can cause problems 🤷‍♀️ 🤷🏾‍♂️");

            return(index);
        }