Although this module theoretically supports location fields other than openlayers wkt (through the hook_build_proximity_index() function), the Batch API operation that actually rebuilds the index uses openlayers_proximity_get_types(), which limits the content types that get indexed to only 'openlayers_wkt' fields.

I'll try to think of a way to refactor the hook_build_proximity_index() and openlayers_proximity_get_types() functions to solve this.

CommentFileSizeAuthor
#3 openlayers_proximity-918290.patch2.12 KBtom_o_t

Comments

ademarco’s picture

That's right. Instead of a direct call to openlayers_proximity_get_types() the batch api should invoke a hook to get the content types the index should be rebuilt for. openlayers_proximity_get_types() is indeed openlayers_proximity's implementation of such a hook. Something like:


/**
 * Barch API operation callback.
 */
function openlayers_proximity_rebuild_index(&$context) {
  
  if (empty($context['sandbox'])) {
    $context['sandbox']['progress'] = 0;
    $context['sandbox']['current_node'] = 0;
    $context['sandbox']['types'] = module_invoke_all('get_proximity_type');
...

And then openlayers_proximity_get_types() becomes:

/**
 * Implementation of hook_get_proximity_type()
 */
function openlayers_proximity_get_proximity_type() {
  $types = array();
  $fields = content_fields();
  foreach ($fields as $field) {
    if ($field['type'] == OPENLAYERS_PROXIMITY_FIELD_TYPE) {
      $types[$field['type_name']] = $field['type_name'];
    }
  }
  return $types;
}
tom_o_t’s picture

Cool - I'll submit a patch for this soon.

tom_o_t’s picture

Status: Active » Needs review
StatusFileSize
new2.12 KB

Patch attached - implements hook_openlayers_proximity_get_types().
I also changed the query that selects node by type to use db_placeholders() so that the types array is handled properly.

ademarco’s picture

Status: Needs review » Fixed

Great! Thanks for patching! Committed: http://drupal.org/cvs?commit=425506

Status: Fixed » Closed (fixed)

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

Marko B’s picture

Does this work with location module, i am trying to index but nothing is happening and i keep getting 0 indexes and then i guess prox. search doesnt work because of it?