Ejemplo n.º 1
0
        public void SearchTest()
        {
            var config = new SearchIndexConfig();

            using (var searchIndex = new SearchIndex(CreateDefaultSearchIndex, config))
            {
                var result = searchIndex.Search("file content");
                Assert.AreEqual(2, result.Total);

                result = searchIndex.Search("*ile");
                Assert.AreEqual(2, result.Total);

                result = searchIndex.Search("ile");
                Assert.AreEqual(2, result.Total);

                result = searchIndex.Search("tte");
                Assert.AreEqual(2, result.Total);

                result = searchIndex.Search("reft");
                Assert.AreEqual(1, result.Total);

                result = searchIndex.Search("stile");
                Assert.AreEqual(1, result.Total);
            }
        }
Ejemplo n.º 2
0
 public LuceneContentSearchHandler(SearchHandler searchHandler, IContentRepository contentRepository, IContentTypeRepository contentTypeRepository, LanguageSelectorFactory languageSelectorFactory, SearchIndexConfig searchIndexConfig)
 {
     Validator.ThrowIfNull("searchHandler", searchHandler);
     Validator.ThrowIfNull("contentRepository", contentRepository);
     Validator.ThrowIfNull("contentTypeRepository", contentTypeRepository);
     Validator.ThrowIfNull("languageSelectorFactory", languageSelectorFactory);
     this.searchHandler           = searchHandler;
     this.contentRepository       = contentRepository;
     this.contentTypeRepository   = contentTypeRepository;
     this.languageSelectorFactory = languageSelectorFactory;
     this.searchIndexConfig       = searchIndexConfig;
     if (this.NamedIndex != null)
     {
         this.namedIndexes = new System.Collections.ObjectModel.Collection <string>();
         this.namedIndexes.Add(this.NamedIndex);
     }
 }
Ejemplo n.º 3
0
        public void AsciiFoldingTestTest()
        {
            var config = new SearchIndexConfig()
            {
                AnalyzerName = "polish",
                //AsciiFolding = true
            };

            using (var searchIndex = new SearchIndex(CreateSearchIndex, config))
            {
                var result = searchIndex.Search("stół");
                Assert.AreEqual(1, result.Total);

                result = searchIndex.Search("stol");
                Assert.AreEqual(1, result.Total);
            }

            void CreateSearchIndex(SearchIndexBuilder searchIndex)
            {
                searchIndex.Index("words", "Words", "Stół z powyłamywanymi nogami.");
            }
        }
Ejemplo n.º 4
0
 public CategoriesSearchProvider(LocalizationService localizationService, ISiteDefinitionResolver siteDefinitionResolver, IContentTypeRepository <ContentType> contentTypeRepository, EditUrlResolver editUrlResolver, ServiceAccessor <SiteDefinition> currentSiteDefinition, IContentRepository contentRepository, ILanguageBranchRepository languageBranchRepository, SearchHandler searchHandler, ContentSearchHandler contentSearchHandler, SearchIndexConfig searchIndexConfig, UIDescriptorRegistry uiDescriptorRegistry, LanguageResolver languageResolver, UrlResolver urlResolver, TemplateResolver templateResolver, IEnumerable <IContentRepositoryDescriptor> contentRepositoryDescriptors) : base(localizationService, siteDefinitionResolver, contentTypeRepository, editUrlResolver, currentSiteDefinition, contentRepository, languageBranchRepository, searchHandler, contentSearchHandler, searchIndexConfig, uiDescriptorRegistry, languageResolver, urlResolver, templateResolver)
 {
     _localizationService          = localizationService;
     _contentRepositoryDescriptors = contentRepositoryDescriptors;
 }
Ejemplo n.º 5
0
 public static LuceneContentSearchHandler CreateInstance(SearchHandler searchHandler, IContentRepository contentRepository, IContentTypeRepository contentTypeRepository, LanguageSelectorFactory languageSelectorFactory, SearchIndexConfig searchIndexConfig)
 {
     return(new LuceneContentSearchHandler(searchHandler, contentRepository, contentTypeRepository, languageSelectorFactory, searchIndexConfig)
     {
         ServiceActive = SearchSettings.Config.Active
     });
 }
 public ContactDataSearchProvider(LocalizationService localizationService, SiteDefinitionResolver siteDefinitionResolver, IContentTypeRepository <ContentType> contentTypeRepository, EditUrlResolver editUrlResolver, IContentRepository contentRepository, ILanguageBranchRepository languageBranchRepository, SearchHandler searchHandler, ContentSearchHandler contentSearchHandler, SearchIndexConfig searchIndexConfig, UIDescriptorRegistry uiDescriptorRegistry) : base(localizationService, siteDefinitionResolver, contentTypeRepository, editUrlResolver, contentRepository, languageBranchRepository, searchHandler, contentSearchHandler, searchIndexConfig, uiDescriptorRegistry)
 {
 }