asp.net mvc - Solrnet query to use relevancy for search -


i have indexed "stockavailability" field solr true or false values. means if products in stock stockavailability field has "true" value otherwise has "false" value.

now want search result per relevancy, means want show "in stock" products first "out of stock" products.

example:

assume if search "mouse", returns 10 products. if product "mouse special mouse" has no stock , remaining products have stock want show other products first in stock on search result page out of stock products.

how can perform solr solrnet query this?

thanks.

based on have described, need sort results. applying sort query on stockavailability field should desired results.

solr:

http://<solrurl>/select?q=mouse&sort=stockavailability&20desc

solrnet:

var results = solr.query(new solrquery("mouse"), new queryoptions {     orderby = new[] {new sortorder("stockavailability", order.desc)} }); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -