Copied to clipboard

Flag this post as spam?

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


  • Sher 42 posts 62 karma points
    Dec 09, 2011 @ 07:18
    Sher
    0

    Property Not available in SearchResult

    Hi All,

    I am trying to implement search in umbraco, i have modified the configuration files and also setup code for search, it is al working fine except it is not getting a property from document type, which is suppose to show page description, and it is accesing all the other properties.

    my code is as belows.

     

    Thanks In Advance

    Sher

     

    ExamineIndex.config

     <IndexSet SetName="WebsiteIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/WebsiteIndexSet/">
      </IndexSet>

    ExamineSettings.config

    <add name="WebsiteIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
              dataService="UmbracoExamine.DataServices.UmbracoDataService, UmbracoExamine"
              supportUnpublished="false"
              supportProtected="false"
              analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
              enableDefaultEventHandler="true"/>

    <add name="WebsiteSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    Code in user control

    string[] searchFields = { "nodeName","nodeTypeAlias","pageDescription","bodyText", "nodeName", "siteName", "siteDescription", "mainHeading","heading1","heading2","heading3","heading4","text1","text2","text3","text4",
                                        "previewText","headerText","footerText","streetAddress","city","telephone","fax","email","fAQ"
                                        };
                var criteria = ExamineManager.Instance.SearchProviderCollection["WebsiteSearcher"].CreateSearchCriteria();

                var filter = criteria.GroupedOr(searchFields, SearchTerm).Not().Field("umbracoNaviHide", "1").Compile();

                SearchResults = ExamineManager.Instance.SearchProviderCollection["WebsiteSearcher"].Search(filter);

     

     

    the funtion with exception...

    public string loadPageDescription(SearchResult sr)
        {
            try
            {
          string pageDesc = sr["pageDescription"];//Get an exception here although the property exists and has data
                return pageDesc;
            }
            catch
            {
                return sr["nodeName"];
            }

        }

     

     

     

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Dec 09, 2011 @ 09:40
    Dave Woestenborghs
    0

    Maybe you can check with Luke to see if your property is in the index? http://www.getopt.org/luke/

    A second check could be that not all nodetypes have the field pageDescription.

  • Sher 42 posts 62 karma points
    Dec 12, 2011 @ 15:33
    Sher
    0

    Thanks Dawoe for the reply, there were some testing Document types in my project and PageDescription was not included in it, deleted them :) and now it is working fine.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies