This is a band-aid fix that gets CCK fields working the way they should. We index the key from the key=>value pairs for option widgets, and currently we DISPLAY the key too. We need to display the value. This means we need to be able to look it up. There are lots of nasty little problems with this that all boil down to a desperate need for some serious replumbing. But until then we can live with the bandaid. I'm committing the attached patch but leaving the issue open because it needs discussion and other ideas. The code is more than a little hacky.
| Comment | File | Size | Author |
|---|---|---|---|
| #46 | apachesolr-551582-46.patch | 5.12 KB | misc |
| #30 | apachesolr_551582.patch | 4.75 KB | drewish |
| #27 | rollback-6--1-592594.patch | 15.89 KB | pwolanin |
| #13 | apachesolr_cck_text_callback-D5.patch | 18.85 KB | claudiu.cristea |
| #13 | apachesolr_cck_text_callback-D6.patch | 16.02 KB | claudiu.cristea |
Comments
Comment #1
robertdouglass commentedCommitting this followup patch as well.
Comment #2
Scott Reynolds commentedThis is my way of subscribing :-D. I did a bunch of stuff to get around this exact problem with this handler. This could me the death of this handler which feels hackish.
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/apachesolr_...
Comment #3
robertdouglass commentedComment #4
robertdouglass commentedAnother followup patch. It's difficult getting the facets and breadcrumbs display right. Sometime in the release cycle of the 6.2 branch I want to move away from theme functions and get some better pattern in place. Committing the attached patch.
Comment #5
janusman commentedRelated? #551292: Turn facet block functions into an interface with different class implementations
Comment #7
robertdouglass commentedComment #8
claudiu.cristeaAs I can see...
$mappingsarray structure is changing: former "callback" became "indexing callback", "display callback" was addedcontent_format()function (from CCK)Are there any other things that I should take care?
Anyway... backporting this will not add the capability to alter the facets text from custom modules. This was accomplished by #584378: Add facet text callback & altering hook. Maybe we want this too...
Proposed solution for
apachesolr_cck_text_field_callback():Comment #9
claudiu.cristeaBackporting this issue to 6.x-1.x & 5.x-2.x I found that the
apachesolr_cck_text_field_callback()is not working correctly for CCK fields other than: number, text or any other CCK field that store its value in the value key of the item array.For example if a nodereference CCK field is passed to this function it will return an empty value. This is because nodereference stores the main value in the nid key rather than "value" key. For the node reference CCK field the
content_format()function should be called:And so on... We may found other storage models in the "CCK World"... and we do.
That's why I think that this patch must be improved in this way for 5.x-2.x, 6.x-1.x and 6.x-2.x as well. I'm changing the state of the ticket to reflect this and shortly I will provide a patch for 5.x-2.x.
Comment #10
claudiu.cristeaBefore creating a patch I'd like to know what is your opinion about my proposal for
apachesolr_cck_text_field_callback()function. Note that it's for 5.x-2.x branch but it shouldn't be different for 6.x.Comment #11
claudiu.cristeaHere's the patch for 5.x-2.x (DRUPAL-5--2). In the patch I used the callback from #10.
Comment #12
claudiu.cristeaComment #13
claudiu.cristeaHere are both patches, for:
I must make an IMPORTANT NOTE: In DUPAL-6--2 patch there is a mistake. In
apachesolr.index.incwe have:but the key is wrong, it should be indexing_callback and not "indexing callback" (note the underscore instead of " " - space). This is because
$cck_infois obtained fromapachesolr_cck_fields()and there this field is build first as:and then transform into array here...
In my opinion we must fix this confusion in the future by replacing everywhere "indexing callback" with "indexing_callback". Generaly I'm not a fan of key that contains spaces (such as
$op == "update index").Comment #14
robertdouglass commentedI agree with the spaces vs underscore conclusion and am to blame for introducing the inconsistency.
Comment #15
claudiu.cristea@robertDouglass,
An input on #10 (#9) would be very helpful before committing to 5.x-2.x & 6.x-1.x. And if it's OK then you'll have to port it also in 6.x-2.x.
Thanks!
Comment #16
robertdouglass commented@claudiu.cristea - need to think about it more. You've come up with a scheme to make a centralized function whereas I (in 6.2) have a scheme to accommodate callbacks. I have to weigh the pros and cons.
Comment #17
claudiu.cristeaWhat's committed right now in 6.x-2.x is this:
This function doesn't work for nodereference and doesn't provide any "open door" to modules. It only let CCK fields that are stores values in the "value" key. No chance for the other ones.
My function is a hybrid
A more "liberal" choice it can be: letting only the hook invoker in this function and write hook implementations only for native CCK field types...
Comment #18
Scott Reynolds commented#592594: CCK arguments not integrating properly with facet blocks is blocked until resolution on this issue
Comment #19
robertdouglass commentedScott, do you have an opinion on the proposed solution above?
Comment #20
claudiu.cristeaAny review on this?
Thanks.
Claudiu
Comment #21
claudiu.cristeaHey guys,
I have to move forward with this... Everything is so slow here... It's simple: apachesolr_cck_text_field_callback() is NOT working if you have CCK fields like nodereference.
I don't know what to do... I received no reviews from community for the proposed patch... This is blocking everything on this backport.
I will mark this as RTBC and wait another 24h... After that I will:
Thanks.
Comment #22
claudiu.cristeaThe 2 patches were committed to CVS (DRUPAL-5--2 & DRUPAL-6--1).
Porting now to 6.x-2.x-dev.
Comment #23
claudiu.cristeaThis is fixed now in all branches.
Comment #24
claudiu.cristeaComment #25
pwolanin commentedThese commits to 6.x will be rolled back for further discussion.
Also, in general leave any fixed issue open for the bot to close after 2 weeks.
Comment #26
pwolanin commentedThis patch to 6.x changed solrconfig.xml, which looks like it was just sloppy pick-up of changes to your working copy. If you need review on a critical issue, please reach out - obviously we've all been very busy recently and not able to follow the issue queue constantly.
Comment #27
pwolanin commentedhere is my 6.x-1.x roll-back patch
Comment #28
pwolanin commentedcommitted roll-back for 6.x-1.x.
Comment #29
drewish commentedThis is still buggy in 6.x-2.x. I believe the changes are the cause of #550534: Search 404 incompatibility which I also encountered when trying to figure out why the user and taxonomy facet blocks were displaying incorrect labels.
It boils down to the fact that this patch only halfway converted the breadcrumb theme functions to accept a $field array with the '#value' key containing the actual value (notably the hook_theme implementation wasn't updated to use the new argument names).
apachesolr_search_nested_facet_items()is still callingapachesolr_breadcrumb_*with $field['#value'] rather than $field. We either need to pass $fields everywhere or the appropriate value everywhere. OrSolr_Base_Query::get_breadcrumb()needs to be smarter about checking if the facet is a CCK field by checking if $breadcrumb_name afterdrupal_alter('apachesolr_theme_breadcrumb', $breadcrumb_name);gets called but personally I think that's a bad idea.Comment #30
drewish commentedOkay here's a patch that tries to move all the breadcrumb code to pass in arrays with the value stored in the #value key. It fixes the facet blocks for users and taxonomy terms, and I believe it will address #550534: Search 404 incompatibility.
Comment #31
robertdouglass commented@drewish - nice cleanup. Thanks.
Comment #32
robertdouglass commentedWould be nice to do similar cleanup in 5.2.
Comment #33
robertdouglass commentedComment #34
marcp commentedJust want to be sure -- it looks like this didn't make it into 6.x-1.0-rc5, is that right?
Comment #35
harking commentedYeah, this didn't make it in to 6.x-1.0-rc5 and is causing issues with search404 integration.
See #550534: Search 404 incompatibility
Comment #36
SergeyR commentedcase of value (label) =html (particulary i tried to represent image as a facet choice) doesn't work
please advice any another possibilities to realize idea for facets choices to be another than just text (especially images are the most wanted)
Comment #37
SergeyR commentedComment #38
pwolanin commentedso apparently the 5.x code is broken, and we need to discuss the 6.x-1.x code?
We'd prefer not to make significant API changes to 6.x-1.x
Comment #39
jpmckinney commentedThis issue seems to have caused an unholy mess. I can't tell what state each branch is in by reading the comments. It seems like only 6.x-1.x was rolled back.
Comment #40
jpmckinney commentedFollow-up patches that would need to be applied to 6.x-1.x if we re-apply this patch there:
#724440: Current search does not display properly the CCK filters
parts of #592722-3: PHP notices
Comment #41
jpmckinney commentedComment #42
sheise commentedI'm with jpmckinney as to being a bit mixed up as to the current state of this issue. I patched 6.x-1.x-dev with the patch in #30 but with unsuccessful results.
If anyone could post an update as the status of this issue it would be greatly appreciated.
Thanks so much.
Comment #43
pwolanin commentedSeems like this is fixed for 6.x-2 and HEAD. We are not going to make these changes in 6.x-1.x
Comment #44
sheise commentedThank you!
I can confirm that this is working with 6.x-2.x-dev.
Comment #46
misc commentedHad to have this working in 6.x-1.6, did some quick fixes to get the patch #30 working for that version.
Comment #47
kingman1016 commentedDo we have to fix this in 1.x now?
Comment #48
nick_vhpwolanin said :
The most important thing is to finish 7.x-1.x and a backport has already started to get this version working with D6. This issue stays closed.
Comment #49
misc commentedAgree, just needed to have the patch online.