We are using SolrNet API to Index and Search a set of documents. The corresponding POCO representing the Solr document is
internal class IndexDocument
{
[SolrField("DocId")]
public long DocId { get; set; }
[SolrField("DocTitle")]
public string DocTitle { get; set; }
[SolrField("Content")]
public string Content { get; set; }
}
We can index data and successfully return the search results. The requirement is to return the relevance score of the result items along with the solr document attributes. We can return the score data by adding "score" as a field in the search request to solr. But the issue is how do we accept the score data in the solr results since this is not a part of the solr document class. We use the following snippet to execute the search:
SolrQueryResults<IndexDocument> results = SolrInstance.Query(query, options);
We can get the score data returned when we execute the query from the solr admin interface but how do we return the score data in the results object since the search results are returned only in terms of the IndexDocument class. The other parameters of the SolrQueryResults class like Grouping, Higlights, SimilarResults, Terms, etc., which are not typically related to the Solr document class, are also not suitable to return the score data.