コード例 #1
0
ファイル: Global.asax.cs プロジェクト: randyammar/Examine
        /// <summary>
        /// Creates the application indexes
        /// </summary>
        /// <param name="examineManager"></param>
        public void CreateIndexes(IExamineManager examineManager)
        {
            var adFactory = new AzureDirectoryFactory();

            var simple2Indexer = examineManager.AddIndex(
                new LuceneIndex(
                    "Simple2Indexer",
                    adFactory.CreateDirectory(
                        new DirectoryInfo(Context.Server.MapPath("~/App_Data/Simple2IndexSet")))));

            var secondIndexer = examineManager.AddIndex(
                new LuceneIndex(
                    "SecondIndexer",
                    adFactory.CreateDirectory(
                        new DirectoryInfo(Context.Server.MapPath("~/App_Data/SecondIndexSet")))));

            var azureIndexer = examineManager.AddIndex(
                new AzureSearchIndex("AzureIndex", "examine-test", "F72FFB987CF9FEAF57EC007B7A2A592D",

                                     //TODO: Azure Search needs a static definition of fields! ack!
                                     //However in the Azure Portal it says: Existing fields cannot be changed or deleted. New fields can be added to an existing index at any time.

                                     new FieldDefinitionCollection(
                                         new FieldDefinition("Column1", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column2", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column3", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column4", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column5", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column6", FieldDefinitionTypes.FullText))));

            var multiSearcher = examineManager.AddSearcher(
                new MultiIndexSearcher(
                    "MultiIndexSearcher",
                    new[] { simple2Indexer, secondIndexer }));
        }
コード例 #2
0
        /// <summary>
        /// Creates the application indexes
        /// </summary>
        /// <param name="examineManager"></param>
        public void CreateIndexes(IExamineManager examineManager)
        {
            var adFactory = new AzureDirectoryFactory();

            var simple2Indexer = examineManager.AddIndex(
                new LuceneIndex(
                    "Simple2Indexer",
                    adFactory.CreateDirectory(
                        new DirectoryInfo(Context.Server.MapPath("~/App_Data/Simple2IndexSet")))));

            var secondIndexer = examineManager.AddIndex(
                new LuceneIndex(
                    "SecondIndexer",
                    adFactory.CreateDirectory(
                        new DirectoryInfo(Context.Server.MapPath("~/App_Data/SecondIndexSet")))));

            var multiSearcher = examineManager.AddSearcher(
                new MultiIndexSearcher(
                    "MultiIndexSearcher",
                    new[] { simple2Indexer, secondIndexer }));
        }