0
votes

Is there an equivalent solr query using SolrNet for this SQL query?

SELECT COUNT(field1), SUM(field2) FROM table1 GROUP BY field3, field4

Thanks

1

1 Answers

1
votes

Solr is not a direct replacement for SQL.

You may want to try :-

  1. Grouping on Multiple fields is not yet implemented, although a JIRA exists for the same SOLR-2553 & SOLR-2526.
  2. Option you can try to create a new field with combination of Field3_Field4 and use that field for Grouping.
  3. SUM(field2) can be handled at client side by manually adding all the results within the group. However, for this you need to return all the results from the group.
  4. Count(field1) can be implemented with group.facet feature.