Closed (won't fix)
Project:
Apache Solr Search
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Dec 2009 at 10:49 UTC
Updated:
29 Nov 2011 at 15:13 UTC
I copied and adapted the sample code for FileField integration, so now I have the mime type as facet; But I also would like to have the file name index for my custom queries, is it possible to have multiple indexes for the same field ?
I need more than one index per field, and because the field_name is the key in apachesolr_cck_apachesolr_cck_fields_alter() ($mappings['per-field'][$field_name] is the key) I can't do this.
Comments
Comment #1
swentel commentedCould this be related with #664884: Several php notices also ? There is a patch there.
Comment #2
pounardI dont think both are linked. My post is more a feature request than a bug report. I want the ability to describe arbitrary indexes on more than one data.
In CCK, 1 field = n values = n * n technical data
What I need here is to create an index per technical data
The simpler example is FileField, there is a description, an filename, and a filemime. I want three indexes for my Solr queries (not much facets, I'm doing a custom module here).
Comment #3
robertdouglass commentedPlease clarify what you mean when you say "index"?
In 6.2 there is a way to create multiple documents from every node, so it should also be possible to create separate documents for each stored value of a field. Please look at the comment search module.
Comment #4
ayalon commentedI have the same issue. I wanted to add the filemime and the filepath to the index as stored fields. (thx to pounard for the helper module).
In the callback function I can define only one array with a key=>value pair. How can I index more than one value per cck field?
Example callback for filefield (not working at all):
As a result, only the last value (in my case the filemime) will be added to the index.
Comment #5
ayalon commentedCan someone give a short repsonse to this?
I have the same case with the link cck field:
Comment #6
ayalon commentedThis issue is still open. It's possible to index multivalue fields. But it is not possible to index fields consisting of multiple values.
Example:
filefield: multiple entries containing field filepath, filemime, etc.
url: multiple urls containing fields url, title
apachesolr.index.inc
Comment #7
very_random_man commentedOne work around I'm currently playing with is to use the hook_apachesolr_cck_fields_alter() for quickly adding fields I want to facet by and adding further fields using hook_apachesolr_update_index().
For example if your searchable content is 'publication' and you wanted to facet by 'publisher', a CCK node reference, but also want to include some other field relating to publisher in your search response, you could use hook_apachesolr_cck_fields_alter() to add a per-field mapping for the publisher node ref (including the title, rather than the nid) and then use hook_apachesolr_update_index() to alter the index document and add the extra fields in.
Seems a bit clunky but works fine.
Comment #8
pounardYes it should work, actually doing this for a lot of custom indexes. For the case of CCK field, it would be better that the main API took care of this by itself.
Comment #9
3dloco commented+1
Comment #10
ayalon commentedjep this is still an issue...
Comment #11
drewish commentedsubscribing
Comment #12
jpmckinney commentedNot a bug.
Comment #13
jpmckinney commentedI think comment in #7 describes the way to go, going forward.
Comment #14
ayalon commentedHey! This IS a bug and it is NOT fixed. The main API supports CCK but does not support every field properly. Please read the issue description and also the examples carefully. The file field ist the best example.
Comment #15
jpmckinney commentedThe apachesolr module doesn't say anywhere "we support all CCK fields", so I don't consider this a bug. People have documented how to support some of the CCK fields that are not supported in core. Unless I see a patch, this is a support request, not even a feature request.
Comment #16
pounard#15 @jpmckinney: You are totally right, supporting *all* CCK fields in a generic way seems impossible (metadata fields, file fields, etc..). But a cool feature would be a good base support for some well known CCK fields (including the original support request which was to handle nicely multivalued fields). Once this done, other CCK types than text and number basically could implement their own support as contrib modules.
Comment #17
jpmckinney commentedSounds good, but I don't think any of the maintainers will write the patch, so this issue may be open for a while.
Comment #18
jpmckinney commentedComment #19
mguillermin commentedI was facing the same problem. I wanted to force a "multiple" type field in solr for a specific cck field. My solution was to authorize the setting of multiple from a hook with a small patch. It allows settings the field multiple even if it is not "multiple" in the cck content type.
In apachesolr.module, I've made this change on line 1549 :
With this modification, I can register the following mapping in my hook :
and use a custom code for indexation :
If you think this can be usefull, I can submit a "clean" patch.
Comment #20
jaykainthola commentedHi,
Could you add complete patch for this?
Thanks
Comment #21
pwolanin commentedComment #22
ayalon commentedWhy was this issue closed without a comment?
Comment #23
pounardI guess that it's rather old and the module so much evolved that it is not even revelant anymore, but yes I agree that a comment would be nice!
Comment #24
digi24 commented@pounard:
I do not think that this problem has disappeared yet, nor lost its relevancy.
I would be very thankful, if anyone find a way to handle multiple values in multivalue fileds in D6.