예제 #1
0
        private TestIndex CreateTestIndex(Directory luceneDirectory, string[] fieldNames)
        {
            var indexer = new TestIndex("TestIndex", luceneDirectory, fieldNames);

            using (indexer.ProcessNonAsync())
            {
                //populate with some test data
                indexer.IndexItem(new ValueSet("1", "content", new Dictionary <string, object>
                {
                    [fieldNames[0]] = "Hello world, there are products here",
                    [UmbracoContentIndex.VariesByCultureFieldName] = "n"
                }));
                indexer.IndexItem(new ValueSet("2", "content", new Dictionary <string, object>
                {
                    [fieldNames[1]] = "Hello world, there are products here",
                    [UmbracoContentIndex.VariesByCultureFieldName] = "y"
                }));
                indexer.IndexItem(new ValueSet("3", "content", new Dictionary <string, object>
                {
                    [fieldNames[2]] = "Hello world, there are products here",
                    [UmbracoContentIndex.VariesByCultureFieldName] = "y"
                }));
            }

            return(indexer);
        }