Reputation: 5670
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?
Upvotes: 0
Views: 354
Reputation: 52809
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.
Upvotes: 2