Hi Mari,
First off is DeliveryCode a string in your class? Why I am asking is that it is indexed as a string but it contains only numbers. Could it be that you have change the backing property from string to int? Then this might happen since it then can't bind it correctly when deserializing.
/Marcus
@Markus: The DeliveryCode property is of type string:
public string DeliveryCode { get; set; }
@Petter: I'm using a Find query to retrieve a list of DeliveryLocation objects - note that this is not CMS data.
The query looks like this:
List<FindModels.DeliveryLocation> result =
SearchClient.Instance.Search<FindModels.DeliveryLocation>()
.Filter(f => f.DeliveryZipCode.Match(zipCode))
.Filter(f => f.CountryCode.MatchCaseInsensitive(countryCode))
.Take(50).GetResult().ToList();
I don't think that is an issue. Was only if you had changed types and not reindexed. And the backing class didn't represent the object in the index correct.
Are we 100% certaain that all models have DeliveryCode set? I have never seen this before so I am trying to rue out the obvious first.
Yes, DeliveryCode is set. This happens on all results/queries: I have two properties that are of type string in the index:
"DeliveryZipCode$$string": "0767",
"DeliveryCode$$string": "3118155",
- they are always null when model is returned from a query.
I must admit this is very strange.
It could be a serilization issue but then you should see some errors in the log if you have it turned on. Altho I doubt it since it doesn't seem to be the hardest thing to serialize.
Is it possible for you to try and reindex and see if it still remains?
/Marcus
Reindexing have no effect.
I've added the data to a test find service. If you want, I can email you the service address and model class - then you can test queries yourself. (I'll need you email address).
Aparently this happens when my model class (the object I'm indexing) does not have a default empy contructor.
I have a model DeliveryLocation which is indexed using Find. If I look at a specific object in the index (using Find Explorer), I can see that that all properties on the model has correct values. One of the properties is called DelliveryCode:
"DeliveryCode$$string": "3118155"
However, when I retrieve the object using a Find query, DeliveryCode and several other properties is null.
Anyone seen this behavior before? Is it a bug?