Currently only single valued fields are possible to do range queries on due to limitations of Solr and the fact that these were not indexed using the sortable flag.

See : http://stackoverflow.com/questions/16416396/querying-solr-multi-valued-f...

When we index Drupal Commerce product that have different variations we do need to filter on price for each of the variations of this product. The documentation tells us that we should only do range queries for multiValued field if we are using the sortable fields. In code this means sint, sdouble and sfloat.

Attached patch fixes this and also adds some flexibility to the handles so that if user input is defined it does not go back to the machine values of the solr stats but it keeps the handles at whatever value the user has selected.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nick_vh’s picture

FileSize
5.31 KB
danielmrichards’s picture

Status: Active » Reviewed & tested by the community
FileSize
5.29 KB

Patch in #1 works nicely for me. Just made a small change to reinstate the caching of the statistics result.

BR0kEN’s picture

Status: Reviewed & tested by the community » Needs work

Unfortunately patch breaks the search on Solr 4.x. Not whole logic in it, but exact this place:

    if (in_array($field_info['index_type'], array('sint', 'sdouble', 'sfloat'))) {
      $field_info['multiple'] = TRUE;
BR0kEN’s picture

Solr 3.x - patch works well.
Solr 4.x - can not use FieldCache on multivalued field: <FIELD>
Solr 5.x - Stats can only facet on single-valued fields

BR0kEN’s picture

BR0kEN’s picture

Issue tags: +DevDaysSeville