http://drupal.org/project/references

/**
 * Implements hook_apachesolr_field_mappings() on behalf of CCK.
 */
function content_apachesolr_field_mappings() {
  $mappings = array(
    'node_reference' => array(
      'display_callback' => 'apachesolr_cck_nodereference_field_callback',
      'indexing_callback' => 'apachesolr_cck_nodereference_indexing_callback',
      'index_type' => 'integer',
    ),
    'user_reference' => array(
      'display_callback' => 'apachesolr_cck_userreference_field_callback',
      'indexing_callback' => 'apachesolr_cck_userreference_indexing_callback',
      'index_type' => 'integer',
    ),
  );

  return $mappings;
}

At a minimum, the function should be split into node_reference_apachesolr_field_mappings and user_reference_apachesolr_field_mappings.

Comments

jpmckinney’s picture

Status: Active » Needs work
StatusFileSize
new5.19 KB

In D7, I don't know what the equivalent of content_format is. These functions still need to be ported: apachesolr_node_reference_field_callback and apachesolr_user_reference_field_callback.

pwolanin’s picture

Oh, yeah - node/user refernce stuff has never been updated for 7.x

pwolanin’s picture

I started work on this in another issue too - would be good to get it fixed.

rafamd’s picture

Relation module is going to be released soon (that's what the maintainers say and the impression I have) and is aimed to become the standard for relating/referencing in D7+. It will replace the (legacy, CCK's straight port) References module and will even provide an upgrade path from references to relation.

Given all this (please, correct me if I'm wrong), shouldn't we think of "Relation" integration for 7.x+ versions of apachesolr ??

rafa

pwolanin’s picture

Well, we will have to see if which is adopted. Is there a reason not to support both? People are surely using noderefernce today.

Please open another issue Relation module support and post your patch there.

rafamd’s picture

I'm not aware of any reason not to support both (at least while references exists), just wanted to share the relation module news because it's been particularly active in the last few weeks.

Can't develop patches with my current drupal knowledge.

32i’s picture

I'm sorry to ask, but I'm curious why this patch wasn't applied yet?
it's kinda hard to apply patch to latest version.

Anyway, many thanks for the path!

Georgique’s picture

StatusFileSize
new6.26 KB

Uploading patch.
What is done:
1. Function content_apachesolr_field_mappings() transformed to two functions node_reference_apachesolr_field_mappings() and user_reference_apachesolr_field_mappings().
2. I remade display callbacks:
apachesolr_nodereference_field_callback($facet, $options);
apachesolr_userreference_field_callback($facet, $options);
3. And indexing callbacks:
apachesolr_nodereference_indexing_callback($entity, $field_name, $index_key, $field_info);
apachesolr_userreference_indexing_callback($entity, $field_name, $index_key, $field_info);

But think it is not all we need.
Please, give me the way and I will do more.

Georgique’s picture

With the last patch I can't see any filters in list. What else should I repair in code?

nick_vh’s picture

filters in what list? This patch is on my todo for today so I'll let you know if I made progress

Georgique’s picture

@Nick_vh
admin/config/search/apachesolr/facets

nick_vh’s picture

StatusFileSize
new18.07 KB
new7.06 KB

@georgique You were very near a good solution! Please try out the patch I have attached.
I was able with this patch to select my node reference field, show it as a block and have a human readable output.

Example:
Search | Smartphone compare.jpg

nick_vh’s picture

Status: Needs work » Needs review
Georgique’s picture

It works for me fine.
P.S.: Think it would be fine option for the future to set max length of the titles in filter and cut it.

nick_vh’s picture

Status: Needs review » Fixed

Committed, If you want to make those titles smaller you could open a new issue. Let's do this bit by bit :-)

Status: Fixed » Closed (fixed)

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