문제

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