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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -