vendrhub / vendr-demo-store

Demo store for Vendr, the eCommerce solution for Umbraco v8+
MIT License
25 stars 15 forks source link

Value of examine searchPath field is not correct #10

Closed bjarnef closed 4 years ago

bjarnef commented 4 years ago

It seems the logic indexing value of searchPath field in Examine isn't correct. https://github.com/vendrhub/vendr-demo-store/blob/main/src/Vendr.DemoStore/Composing/DemoStoreComponent.cs#L84

e.ValueSet.Values["path"] returns List<object>.

e.ValueSet.Add("searchPath", e.ValueSet.Values["path"].ToString().Replace(',', ' '));

chrome_2020-09-08_10-54-51

When changing to this in seems to be correct.

e.ValueSet.Add("searchPath", string.Join(", ", e.ValueSet.Values["path"].Select(x => x)));

chrome_2020-09-08_10-59-53

mattbrailsford commented 4 years ago

Good spot, however the purpose of searchPath is that it should be space separated, rather than comma separated as this is what makes it searchable.

Any chance you could submit a PR for this?

bjarnef commented 4 years ago

Ahh okay, then it would need to be this instead:

e.ValueSet.Add("searchPath", string.Join(" ", e.ValueSet.Values["path"].Select(x => x)));

However when I change to this an rebuild the index it seems to show -1,1146,1161,1162,1163 as value for searchPath field.

bjarnef commented 4 years ago

Okay apparently e.ValueSet.Values["path"] returns List<object> and in this case only contains a single item with the path value -1,1146,1161,1162,1163 as an object,

So it seems this works instead:

e.ValueSet.Add("searchPath", e.ValueSet.Values["path"][0].ToString().Replace(',', ' '));

image

bjarnef commented 4 years ago

PR submitted: https://github.com/vendrhub/vendr-demo-store/pull/11

mattbrailsford commented 4 years ago

PR Merged 👍