solr - How to return Search Result Score using Solrnet -


we using solrnet api index , search set of documents. corresponding poco representing 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 , return search results. requirement return relevance score of result items along solr document attributes. can return score data adding "score" field in search request solr. issue how accept score data in solr results since not part of solr document class. use following snippet execute search:

solrqueryresults<indexdocument> results = solrinstance.query(query, options); 

we can score data returned when execute query solr admin interface how return score data in results object since search results returned in terms of indexdocument class. other parameters of solrqueryresults class grouping, higlights, similarresults, terms, etc., not typically related solr document class, not suitable return score data.

you can accomplished 2 poco classes. 1 mapping result retrieved , 1 indexing. make sure add score field in way:

[solrfield("score")] public double score { get; set; } 

only in first class used retrieving data.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -