Esempio n. 1
0
 public void WhenLoadingLotsOfDataShouldNotError()
 {
     foreach (var entry in WikipediaDataLoader.Load(this.GetType()))
     {
         this.index.Index(entry.name, entry.text);
     }
 }
Esempio 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);
            }
        }
Esempio 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);
            }
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
        }