Try our conversational search powered by Generative AI!

SearchFilterHelper

Vote:
 

Hi,

Could you please help me to create SearchFilterHelper?

I created job to perfor m some search operations. And I need to create search criterias. I try do the next:

var searchFilterHelper = new SearchFilterHelper();

CatalogEntrySearchCriteria productsCriteria = searchFilterHelper.CreateSearchCriteria(string.Empty, CatalogEntrySearchCriteria.DefaultSortOrder);

 

But I've got nullreference error for searchFilterHelper. Some properties including QueryString and SearchConfig gives nullreference error.

Could you please advice how to create SearchFilterHelper correctly?

Thank you in advance!

#142075
Nov 30, 2015 13:14
Vote:
 

Vital,

SearchFilterHelper has a static "Current" property that gives you access to the current instance of the helper.

See: http://world.episerver.com/documentation/Class-library/?documentId=commerce/7.5/6AFF86C9

var searchFilterHelper = SearchFilterHelper.Current;


You also might be able to access it via the ServiceLocator.

var searchFilterHelper = ServiceLocator.Current.GetInstance<SearchFilterHelper>();

Hope this helps,

/Matt

#142078
Edited, Nov 30, 2015 16:16
Vote:
 

Hi Matthew,

Thank you for your response. It works for me.

#142149
Dec 02, 2015 16:02
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.