0121 31 45 374
Qoute Icon

Error running scratch indexer in Ucommerce v9+

Tim

We ran into an odd issue today where we suddenly couldn't run the scratch indexer in Ucommerce after making a few changes to the product properties.

We tracked the issue down to the IndexDefinition which was using non-nullable field declarations e.g.

this.Field(p => p["Date"], typeof(DateTime));

Resulted in String was not recognized as a valid DateTime.

We also had an incorrect definition for a string field which was getting declared as a bool which resulted in Input string was not in a correct format.

The fix was fairly simple -when using nullable properties you need to declare them as so in the IndexDefinition but it was one of those head scratchers for a while!

This is how the nullable DateTime declaration should look:

this.Field(p => p["Date"], typeof(DateTime?));

Liked this post? Got a suggestion? Leave a comment