質問

I have uploaded some product data to solr and trying to retrieve it through SolrNet query. when i use SolrQueryByField its working good and when i use simple SolrQuery its not returning any data Working code

var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Product>>();
var results = solr.Query(new SolrQueryByField("id", "SP2514N"));

Not working Code

          var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Product>>();
          var results = solr.Query(new SolrQuery("SP2514N"));

I can't understant why this is not working.Can any one give a hand?

役に立ちましたか?

解決

For the Query SolrQueryByField("id", "SP2514N") would fire the query the id field with SP2514N .

For the Query SolrQuery("SP2514N") would fire the query the default field with SP2514N . The default field is usually defined as text which may not have a match.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top