Example #1
0
        public BasicSearchIndexTest()
        {
            TestLiveDocsOptions options = new TestLiveDocsOptions
            {
                Search = new SearchConfiguration()
            };
            SearchPipeline         searchPipeline     = new SearchPipelineBuilder().Tokenize().Normalize().RemoveStopWords().Stem().Build();
            TestDocumentationIndex documentationIndex = new TestDocumentationIndex
            {
                DefaultProject = new TestDocumentationProject()
            };

            documentationIndex.DefaultProject.Documents.Add(new TestDocument("Cat cat cat dog."));

            basicSearchIndex = new BasicSearchIndex(searchPipeline, documentationIndex, options, null)
            {
                Documents = new[]
                {
                    new BasicSearchIndex.Element
                    {
                        Path           = "cat",
                        LexicalIndexes = new [] { 0, 1, 2 }
                    }
                },
                Lexical = new[] { "cat", "are", "awesome" }
            };
        }
Example #2
0
        public BigSearchIndexTest(ITestOutputHelper output)
        {
            _Output = output;
            TestLiveDocsOptions options = new TestLiveDocsOptions
            {
                Search = new SearchConfiguration()
            };
            SearchPipeline         searchPipeline     = new SearchPipelineBuilder().Tokenize().Normalize().RemoveStopWords().Stem().Build();
            TestDocumentationIndex documentationIndex = new TestDocumentationIndex
            {
                DefaultProject = new TestDocumentationProject()
            };

            _Random = new Random(127442);

            List <string> words = new List <string>();

            for (int i = 0; i < 15000; i++)
            {
                words.Add(WordMaker(_Random.Next(3, 10)));
            }

            // Seed a few english words
            words.Add("person");
            words.Add("year");
            words.Add("way");
            words.Add("day");
            words.Add("thing");
            words.Add("man");
            words.Add("world");
            words.Add("life");
            words.Add("hand");
            words.Add("cat");
            words.Add("code");

            for (int i = 0; i < 1000; i++)
            {
                List <string> content = new List <string>();
                for (int j = 0; j < _Random.Next(10, 5000); j++)
                {
                    content.Add(words[_Random.Next(0, words.Count)]);
                }
                documentationIndex.DefaultProject.Documents.Add(new TestDocument(string.Join(' ', content)));
            }

            _BigSearchIndex = new BasicSearchIndex(searchPipeline, documentationIndex, options, null);
            _BigSearchIndex.BuildIndex().Wait();
        }