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

Forums / Developing with Sitefinity / Including custom fields in SearchManager search

Including custom fields in SearchManager search

2 posts, 0 answered
  1. David
    David avatar
    2 posts
    Registered:
    18 Feb 2013
    30 Mar 2015
    Link to this post

    We are implementing a custom search results widget, and everything is working properly except I have not been able to figure out how to tell SearchManager to include additional fields in the search.  Following the steps described at http://www.sitefinity.com/blogs/team-blog/2012/07/31/sitefinity_-_adding_custom_fields_to_search_index work fine as long as we are using the built in search box and search results widgets.

    Using the following couple of lines of code and passing in the index name and query string I am able to retrieve results against the default columns.  But even thought the additional fields are still identified on the index, they are not being included in the search when I call the SearchManager's Find method.

      SearchManager searchManager = SearchManager.GetManager(null);
      IResultSet results = searchManager.Find(catalog, query);

    Any suggestions that don't involve writing an entire replacement search provider?  Basically, I just need someone from Telerik to clue me in on what you are doing with that SearchFields property on the built-in search results widget so I can replicate the functionality in my own code.

     

    thanks,

    dave

     

               

  2. David
    David avatar
    2 posts
    Registered:
    18 Feb 2013
    30 Mar 2015 in reply to David
    Link to this post

    NVM, found the answer to my question.  Switched to the following code:

    List<String> fields = new List<string> { "Title", "Summary", "Content", "keywords" };
    var searchService = Telerik.Sitefinity.Services.ServiceBus.ResolveService<ISearchService>();
    var compiledQuery = searchService.BuildQuery(query, fields, false);
    var results = searchService.Search(catalog,compiledQuery,null,null,null);

     

     

     

2 posts, 0 answered