Including custom fields in SearchManager search

Posted by Community Admin on 04-Aug-2018 18:34

Including custom fields in SearchManager search

All Replies

Posted by Community Admin on 30-Mar-2015 00:00

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

 

           

Posted by Community Admin on 30-Mar-2015 00:00

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);

 

 

 

This thread is closed