tags:

views:

24

answers:

1

Using SolrNet for querying & faceting. I have a combination of int, tdate and string fields I would like to facet on. However I am unable to mix SolrFacetFieldQuery and SolrFacetQuery (for ranges) and SolrFacetDateQuery (for date ranges) in the same query. I get an error "no best type found for implicitly typed array". How should this best be handled? Clearly don't want to send multiple queries for getting the other facets.

I know this is something silly, but been vexing me....

      results = solr.Query(qry
      , new QueryOptions
      {
          Rows = 250,
          Facet = new FacetParameters
          {
              Queries = new[] 
                        {
                            new SolrFacetFieldQuery("Registry"),
                            new SolrFacetFieldQuery("Status"),
                            new SolrFacetFieldQuery("Type"),
                            //this is where it throws up "no best type found for implicty typed array"
                            new SolrFacetQuery(lessThan25),

                        }
          }

      });
A: 

C# can't infer the common base type, so you have to be explicit about it when creating the array:

Queries = new ISolrFacetQuery[] {
   new SolrFacetFieldQuery("Registry"),
   new SolrFacetFieldQuery("Status"),
   new SolrFacetFieldQuery("Type"),
   new SolrFacetQuery(lessThan25),
}
Mauricio Scheffer
Thanks as always @Mauricio.
Mikos