Error running scratch indexer in Ucommerce v9+

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

Subscribe to TSD

Don’t miss out on the latest posts. Sign up now to get access to the library of members-only posts.
jamie@example.com
Subscribe