コード例 #1
0
        private TestIndex CreateTestIndex(Directory luceneDirectory, string[] fieldNames)
        {
            var index = new TestIndex(LoggerFactory, "TestIndex", luceneDirectory, fieldNames);

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

            return(index);
        }