GetHits always returns 0 for string values
ronaldbarendse opened this issue · 2 comments
When getting the hits from an IFacetResult
, it always returns 0 when the value is a string: results.GetFacet("creatorName").GetHits("Administrator")
.
Looking at the code, this is probably because it uses an object reference comparison:
examine-facets/src/Examine.Facets/FacetResult.cs
Lines 17 to 19 in 19015e1
I can confirm this, as results.GetFacet("creatorName").FirstOrDefault(v => v.Value == "Administrator")
shows a compiler warning: Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'string'
and doesn't return a match.
Using results.GetFacet("creatorName").FirstOrDefault(v => v.Value.Equals("Administrator"))
will return the right facet value though.
Hey @ronaldbarendse!
Firstly, thanks for giving Examine Facets a whirl!
Great find with this issue. I will graciously accept a pull request with a fix, or look at this myself in the near future.
Cheers,
Callum
Hey @ronaldbarendse!
Thanks for fixing this, I've merged the PR and it will be released shortly in v1.1.0! H5YR!
Callum