Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top