I am trying to query records where ParentId = thread OR DataId = Thread. The query keeps timing out on me. Is there something wrong with the query below?
var Test = solr.Query(new SolrQueryByField("ParentId", Thread) ||
(new SolrQueryByField("DataId", Thread)));
I am not an expert in Solr.Net but I have used it for one project. I can only suggest you try couple of things.
First go to your SOLR Admin and try executing the query:
(ParentId:"Thread") OR (DataId:"Thread")
If you get any result back and its not timing out, you can use the same string in Solr.Net like:
string strQuery = "(ParentId:\"Thread\") OR (DataId:\"Thread\")";
// or use * for contains instead of double quotes
var query = new SolrQuery(strQuery);
SortOrder sortOrder = new SortOrder("ParentId");
var solrQueryResult = solr.Query(query, new QueryOptions
{
Rows = 100, //Max Rows returned
Start = 0,
OrderBy = new[] { sortOrder }, //If you want the ordered result
});
var list = solrQueryResult.ToList();//if you want list