Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • JansyRani 21 posts 111 karma points
    May 10, 2016 @ 05:43
    JansyRani
    0

    Umbraco Search feature

    Hi, I have Implemented two project in same solution, that is one for Mvc Project and Another for Mvc Umbraco. but here i have implemented Dynamic Search Feature ,if i search its going to search in both mvc and Umbraco and Displaying the result. I have customeDataservice.cs file too.In this file i'm getting mvc search values. public class CustomDataService :ISimpleDataService { public CustomDataService() { }

        public IEnumerable<SimpleDataSet> GetAllData(string indexType)
        {
            var data = new List<SimpleDataSet>();
            SeabEntityContext seabEntityContext = new SeabEntityContext();
            CategoryRepository categoryRepository = new CategoryRepository(seabEntityContext);
            LanguageRepository languageRepository = new LanguageRepository(seabEntityContext);
            BrandRepository brandRepository = new BrandRepository(seabEntityContext);
            ProductRepository productRepository = new ProductRepository(seabEntityContext);
            ProductViewModelRepository ProductViewModel = new ProductViewModelRepository(productRepository, languageRepository, brandRepository, categoryRepository);
            List<ProductViewModel> things = ProductViewModel.GetAllProducts();
    
            foreach (ProductViewModel thing in things)
            {
                data.Add(new SimpleDataSet()
                {
                    NodeDefinition = new IndexedNode()
                    {
                        NodeId = thing.Id,
                        Type = "content"
                    },
                    RowData = new Dictionary<string, string>()
                {
                    {"title", thing.ProductName},
                    {"contents", thing.ProductLanguages.FirstOrDefault().ProductSubTitle}
                }
                });
            }
    
            return data;
        }
    

    In Examinesetting.config file i have added customeindexer.

      <add name="InternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
           supportUnpublished="true"
           supportProtected="true"
           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" />
    
    
      <!-- default external indexer, which excludes protected and published pages-->
      <add name="ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
               supportUnpublished="false"
               supportProtected="false"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" />
      <add name="ExternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
           supportUnpublished="true"
           supportProtected="true"
           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" />
    
    
      <add name="CustomIndexer" type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine"
                 dataService="Seab.Umbraco.Service.CustomDataService, Seab.Umbraco.Service" indexSet="CustomIndexSet" runAsync="true" />
    
      <add name="CustomMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
           supportUnpublished="true"
           supportProtected="true"
           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" />
    </providers>
    

      <add name="ExternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
    

    analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcards="true" />

      <add name="InternalMemberSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcard="true" />
    
      <add name="ExternalMemberSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcard="true" />
    
      <add name="CustomSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
    

    analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net" enableLeadingWildcard="true" dataService="Seab.Umbraco.Service.CustomDataService, Seab.Umbraco" indexSet="CustomIndexSet" />

      <add name="CustomMemberSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
           analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcard="true" dataService="Seab.Umbraco.Service.CustomDataService, Seab.Umbraco" indexSet="CustomIndexSet" />
    </providers>
    

    And i have changed Examineindex.config file too. when i trying to search it Throws an Error "Value cannot be null.Parameter name: The indexTypes property must be specified for the SimpleDataIndexer provider"

Please Sign in or register to post replies

Write your reply to:

Draft