1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / help me on IIndexerInfo

help me on IIndexerInfo

2 posts, 0 answered
  1. Roland
    Roland avatar
    45 posts
    Registered:
    23 Feb 2009
    24 Apr 2009
    Link to this post
    I checked the IIndexerInfo and it only defines the following:

    string

     

    Culture { get; }

     

     

    Encoding Encoding { get; }

     

     

    Guid ItemID { get; }

     

     

    string MimeType { get; }

     

     

    string Path { get; }

     

     

    byte[] GetData();

    My question is, if this is the only implemented by the IIndexerInfo how will I be able to add another property like for example I want to add "string Title {get;}" in order to be used by my CustomSearchIndex and be added to its return result?

     

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    24 Apr 2009
    Link to this post
    Hello Roland,

    Generally the Interface public properties cannot be changes and you cannot add new one. I am not sure for which item type you want to get the title, but I will give you some samples that covers most of the cases.

    If you want to make the title searchable ( let's say for a icontent item) you can edit
    ~/App_Data/Search/YOUR_INDEX_NAME/fieldsInfoProvider.xml and add the field there

    <?xml version="1.0" encoding="utf-8"?> 
    <fields> 
      <field name="title" weight="1" indexAttribute="" filterTag="title" filterAttributes="" /> 

    The fields you are adding should be registered as metafields and set as searchable in the web.config.


    Another way is implementing the following logic in your custom provider

        public MyIndexer() 
        { 
        } 
        public string MimeType 
        { 
            get 
            { 
                // specify the mime type which will be searched 
                return "text/html"
            } 
        } 
        public byte[] GetData() 
        { 
            string text = "my content"
            // here we are searching between title tags of the html 
            text = text + "<title>" + "your title" + "</title>"
            // encode to text 
            return this.Encoding.GetBytes(text); 
        } 

    If your requirement is different, let us know.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered