More in this section

Forums / Developing with Sitefinity / Custom search provider

Custom search provider

6 posts, 0 answered
  1. David
    David avatar
    26 posts
    Registered:
    12 Jul 2008
    05 May 2009
    Link to this post
    I have created a custom search provider as per this blog post.

    My custom indexer is for a custom people module. My site has a number of sections and each person is attached to a section. Depending on which section the search is done from I want to return only the people from that section.

    To do this I think I just need to be able to get the name of the index from within the indexer. That way I will know which section I should be searching.

    I can't find any way of getting the name/Guid of the Index from within the indexer, is this possible?

    Thanks
    Dave Cooper
  2. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    07 May 2009
    Link to this post
    Hi David,

    I suppose that you have created you own index provider, which is indexing your custom module data.
    The indexing is process you will execute for example once to generate the index files. And then you will search multiple times in the generated index. The search in Sitefinity is done by two controls - SearchBox and SearchResult.

    A way to discover the section of the site in the index, is by using the url. Every item that is indexed has an url (this url is where user goes if he clicks on search result item). To store the url in the Index you supply an url to your class implementing the IIndexerInfo - in the Path property:
    public interface IIndexerInfo 
         string Path { get; } 
    ... 

    You can extend the SearchResult control and filter only the search results that are from specific section (if it is possible for you to determine the section of the site by the url).

    Can you explain more about your implementation - this will help me further to get into the problemWhich version of Sitefinity are you using?

    Greetings,
    Parvan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  3. David
    David avatar
    26 posts
    Registered:
    12 Jul 2008
    11 May 2009
    Link to this post
    Hi,

    I am using 3.6.1870.

    I might be looking at this issue the wrong way but what I want is to be able to set a URL where the indexing will start from, like the page indexer does.

    What you are suggesting below looks like you want me to index everything and then use the URL to filter the results before displaying to the client. Is this right?

    Thanks
    Dave Cooper
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 May 2009
    Link to this post
    Hi David,

    As I see it you want to filter content items, so the case is different than indexing pages. Parvan suggests that firstly you should index all items and then in searchResults you should show the filtered items.
    Here is a sample code of this implementation.

    1.Create a custom SearchResults control that will show our filtered items. Override CreateChildeControls adding our custom filter.
    2. Create your custom SearchToolboxitem.
    3.Register the control in the web.config file.

    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.
  5. David
    David avatar
    26 posts
    Registered:
    12 Jul 2008
    14 May 2009
    Link to this post
    Yes, that makes sense, I was thinking about filtering before indexing but it seems much easier to do the filtering after.

    Thanks for your help with this.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    15 May 2009
    Link to this post
    Hello David,

    You need to pass  dataSource = filteredItems;  before the number of pages that will be returned. Also the filter is created after we check for the  the query string and our list is created ResultItem. Otherwise it will be too earlier to filter the items. All is done is the sample code I sent you.

    Let us know if there is anything else that we can do for you.

    Sincerely yours,
    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.
Register for webinar
6 posts, 0 answered