Hi all,
I'm facing some challenges, trying to understand the "Score" variable yielded on each search result by using a lucene index query. Basically what I'm trying to achieve is to implement a basic search result weight, using the Webnodes Lucene IndexQuery.
Webnodes versions tested: 1612, 1617.
I'm currently doing searches using my method below (included all parameters I use in case it matters).
Then, I iterate through the results filling up my own POCO class, trying to fetch the "Score" and the "ScorePercentage" variables.
I've even tried disabling fuzzy and turning on autofuzzy (q.AutoFuzzy = true),
and disabling fuzzy entirely.
But the "Score" variable (a float) is always "NaN", and the "ScorePercentage" (a byte) is always 0.
I use my search provider like this across several Webnodes installations, and I have not yet managed to get a >0 result on any of the search results yielded.
Do you have any tips as to how I can get positive score parameters on my search results?
Am I missing something? Any tips would be greatly appreciated.
private List DoWebnodesIndexSearch(string searchQuery)
{
IndexQuery q = new IndexQuery();
string fuzzySearchSimilarity = "0.8";
if (FuzzySearch) SearchQuery = SearchQuery + "~" + fuzzySearchSimilarity;
if (ContentClassIdsOverride != null)
{
q.ClassIds = ContentClassIdsOverride;
}
if (SiteIdsOverride != null)
{
q.SiteIds = SiteIdsOverride;
}
q.BodySearch = searchQuery;
q.AddSort(IndexField.ChangeDate, false);
q.ProtectedContent = false;
List searchResultList= WAFContext.Session.Search(q);
return searchResultList;
}
foreach (var nativeSearchResult in DoWebnodesIndexSearch(theQuery))
{
var someClass = new SomeClass
{
..
Relevance = nativeSearchResult.Score,
RelevancePercent = nativeSearchResult.ScorePercent
..
};
}