Try our conversational search powered by Generative AI!

SearchClient.Instance.Index throws error?

Vote:
 

Hi Team,

We implemented find languagerouting for a custom index model.

indexItem.LanguageRouting = new LanguageRouting(Language.English);

When i try to index the model it throws "Object reference not set to an instance of an object".

stack trace:

   at EPiServer.Find.ClientConventions.CompositeLanguageRoutingConvention.GetLanguageRouting(Object instance)
   at EPiServer.Find.Client.Index(Object objectToIndex, Action`1 commandAction)
   at EPiServer.Find.Client.Index(Object objectToIndex)
   

Please help me out.

Regards,

Karthik

Edit:

Actually  i am using this method to set an languagrouting

                indexItem.LanguageRouting = new LanguageRouting(findclient.Settings.Languages.GetSupportedLanguage(language));
#196144
Edited, Aug 20, 2018 14:17
Vote:
 

Hi Karthikeyan,

You can work around by trying another option for Language routing:

SearchClient.Instance.Conventions.ForInstancesOf<WithLanguageRoutingAttribute>().LanguageRoutingIs(x => x.LanguageRouting);

Add this line to your InitializtionModule and it should work.

Hope this help.

/Son Do

#196207
Aug 22, 2018 6:54
Vote:
 

Thanks Son Do,

How can I pass language while search, filtering in find? Note:SearchResultItem is a custom model.

I am done like below one 

ITypeSearch<SearchResultItem> query = SearchClient.Instance.Search<SearchResultItem>(Language.English)
.
.
.ForOrSynonymSearch(subQueryText)
.Filter(x => x.CatalogId.Match(Convert.ToInt32(GlobalSettings.SnSCatalogId)))
.ApplyUserFilter(model.CurrentUser)
.
.
query.GetResult();

But i am getting a result for all languages.

#196219
Edited, Aug 22, 2018 10:42
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.