"Weights" undefined when using UnifiedSearch

Vote:
 

Hi!

I've indexed a whole bunch of page types so that I can search among them using EPiServer Find UnifiedSearch.

However, when I log in and access the EPiServer Find administration sections the list with "weights" contains undefined entries.

You can see this by following this link:

Capture of "weights" in EPiServer Find admin

Has anyone experienced this before, and if so, what could be wrong?

I'm using EPiServer CMS 10.10.4.0 and EPiServer Find CMS 12.6.2.

//Marcus

#191736
Apr 27, 2018 8:40
Vote:
 

Do you use a custom WebApi formatter in your site?

The problem is probably related to a custom WebApi formatter used which interferes with the EditorialBoosting ApiController. The formatter converts all response properties to lowercase, but Find UI expects property names to be capitalized.

#191776
Apr 27, 2018 15:15
Vote:
 

Hi Aniket!

We have code looking like this:

public static class WebApiConfig
{
	public static void Register(HttpConfiguration config)
	{
		// Web API configuration and services

		var formatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
		formatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

		// Web API routes
		...
	}
}

So my guess is that it interferes with the ApiController you mentioned.

What would - in your opinion - be the best way to handle this?

#191780
Apr 27, 2018 15:39
Vote:
 

Can you confirm that removing the code resolves the issue? If it does, I would remove it and check how it affects your application. 

#191784
Apr 27, 2018 16:03
Vote:
 

Removing the code does indeed resolve the issue. Thank you!

As for the CamelCasePropertyNamesContractResolver I decided to enforce it on the controller level rather than the global level.

Got inspiration from

https://stackoverflow.com/questions/19956838/force-camelcase-on-asp-net-webapi-per-controller/19959579

and

https://stackoverflow.com/questions/23504944/camel-casing-issue-with-web-api-using-json-net

#191813
Apr 30, 2018 10:06
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.