Apache Solr's facet definitions will have to reflect the API change in the Facet API project posted in #1161434: Modify "query type" key in facet definition to accept an array once it is committed.

Comments

cpliakas’s picture

Title: Modify Facet API field definitions to reflect API change » Modify Facet API field definitions to reflect API change for the "query type" key
Status: Active » Postponed

Changing title to be more descriptive, postponing until Facet API makes the change.

nick_vh’s picture

StatusFileSize
new2.94 KB

This patch should not be committed until facetapi committed their changes from #1161434: Modify "query type" key in facet definition to accept an array

nick_vh’s picture

StatusFileSize
new4.87 KB

Ignore last patch, this one includes the queryType

nick_vh’s picture

StatusFileSize
new5.51 KB

Mistake

nick_vh’s picture

StatusFileSize
new7.91 KB

New patch following the changes of #1161434: Modify "query type" key in facet definition to accept an array

Also did some white spacing/formatting formatting

nick_vh’s picture

StatusFileSize
new10.41 KB

New one that applies to latest dev

nick_vh’s picture

StatusFileSize
new11.2 KB

Added an extra query so we can get the stats form the field without, this should be cached so we only do this once per field per time period

Need help in this!

nick_vh’s picture

Seems like this breaks OR facets. Still have to confirm if it is this patch that breaks it or the facetapi patch

cpliakas’s picture

Status: Postponed » Needs review

Changing status from "postponed" to "needs review" since the API change at #1161434: Modify "query type" key in facet definition to accept an array has been committed to Facet API.

nick_vh’s picture

I just need someone to confirm that this patch does not break the OR facets in a site. If that is done, we can commit this also

cpliakas’s picture

Status: Needs review » Reviewed & tested by the community

I applied the patch, and the OR facets are working perfectly for me.

cpliakas’s picture

One word of caution, if you commit this patch then Apache Solr Search Integration cannot roll a new release before Facet API does. We will either have to coordinate releases, or you could also leave the old "query type" key in there as Facet API still respects it. This would definitely look silly in the code since it would have both "quert type" and "query types", however it would mitigate upgrade issues.

Just a thought,
Chris

nick_vh’s picture

So you say I should add something like below? I'm not in favor of that since it still could break the facet_slider module then and get undesirable results. Is there a way to tell drupal that a minimum version of a module as dependency is required?

I don't see the problem in waiting for an equal release of facetapi, or telling people that they should use the latest dev from facetapi in combination with the latest dev of apachesolr. Suggestions are wanted here :-)


/**
 * Implements hook_apachesolr_field_mappings().
 */
function field_apachesolr_field_mappings() {
  $mappings = array(
    'list_integer' => array(
      'indexing_callback' => 'apachesolr_fields_default_indexing_callback',
      'map callback' => 'apachesolr_fields_list_facet_map_callback',
      'index_type' => 'integer',
      'facets' => TRUE,
      'query types' => array('term', 'numeric_range'),
      'query type' => term,
      'facet missing allowed' => TRUE,
    ),
    'list_float' => array(
      'indexing_callback' => 'apachesolr_fields_default_indexing_callback',
      'map callback' => 'apachesolr_fields_list_facet_map_callback',
      'index_type' => 'float',
      'facets' => TRUE,
      'query types' => array('term', 'numeric_range'),
      'query type' => 'term',
      'facet missing allowed' => TRUE,
    ),
cpliakas’s picture

Hey Nick.

Your's code is what I was thinking. We are trying to resolve the issue of people upgrading Apache Solr and NOT Facet API. If people are using Facet API <= beta7 then the sliders won't work anyways, so I am not sure this is a big deal. I also wouldn't want to urge people to use the dev release of a module.

Regarding requiring a specific version of a module, this is done in the .info file via the dependencies key. Since the Facet API integration piece isn't a separate module, there is no clean way to do this.

For me, once Facet API goes RC, I plan on removing support for legacy backwards compatible code. Maybe we can add a @todo to remove the "query type" key once Apache Solr goes RC and say "You need at least Facet API >= Beta8"?

~Chris

nick_vh’s picture

Will test if this is working and if it is I will commit it to the development version

nick_vh’s picture

StatusFileSize
new8.53 KB

Seems like all is working!

nick_vh’s picture

StatusFileSize
new11.31 KB

Ups, forgot to do the git add -N

nick_vh’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/apachesolr.moduleundefined
@@ -293,6 +299,11 @@ function apachesolr_facetapi_facet_info($searcher_info) {
+        if (!empty($field_info['query types'])) {
+          $facets[$field]['query types'] = $field_info['query types'];
+        }
+       // TODO : This is actually deprecated but we should still support
+       // older versions of facetapi. We should remove once facetapi has RC1
+        // For reference : http://drupal.org/node/1161444
         if (!empty($field_info['query type'])) {
           $facets[$field]['query type'] = $field_info['query type'];

This todo comment was added in this patch

cpliakas’s picture

Looks good to me.

nick_vh’s picture

Status: Needs work » Fixed

And committed! Great!

Automatically closed -- issue fixed for 2 weeks with no activity.