Closed (fixed)
Project:
Facet API
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Dec 2011 at 19:19 UTC
Updated:
24 May 2012 at 19:10 UTC
Jump to comment: Most recent file
Apache Solr Search Integration will be backported to Drupal 6, and so will Facet API. A 6.x-3.x branch of Facet API will be created from the RC1 tag. A list of the changes that will be required to backport Facet API to D6 are listed below. As the backport progresses, more items will probably be added to this list.
drupal_static() should be replaced by ctools_static()#states propertyhook_block_*() implementations into hook_block()| Comment | File | Size | Author |
|---|---|---|---|
| #81 | 1387164-81.patch | 7.32 KB | gnucifer |
| #77 | 1387164-77.patch | 1.73 KB | gnucifer |
| #75 | 1387164-75.patch | 961 bytes | gnucifer |
| #67 | 1387164-67.patch | 26.17 KB | nick_vh |
| #66 | 1387164-66.patch | 25.75 KB | nick_vh |
Comments
Comment #1
cpliakas commentedBranch created. Switching version.
Comment #2
nick_vhInitial patch that makes most of the things at least accessible
Installing / uninstalling
integration with apachesolr shows already the realms and some of the exposed facets
Required so far for Drupal 6:
dbtng
autoload
ctools
Comment #3
nick_vhOh, I did not even know about the existence of ctools_static! Cool
Comment #4
nick_vhWith ctools_static as proposed
Comment #5
nick_vhForgot to save some files...
Comment #6
nick_vhSmall update. Can't seem to get the config facet links working. I suppose there's a change between Drupal 6 and 7 that I don't see
Comment #7
cpliakas commentedThanks, Nick! I gave you commit access so you can make whatever changes you need directly to the 6.x-3.x branch.
A couple of things...
admin/confis/searchpath is D7 specific. We will probably have to switch toadmin/settingsas the base path for settings pages.Excuse short response. Typing one-handed with baby on my lap.
Comment #8
nick_vhHi Chris!
I think the patch already incorporates admin/settings but still I am having some small problems. Nothing that cannot be resolved.
Well, I agree that the DBTNG should disappear but to make the backport easier it was a quick step forward. I did the same for Apache Solr backport but removal of these DBTNG queries will go away :-)
The autoload can go away as well, if we manage to make everything stable +-
I could also use some help with CTools since I am still not very familiar with all that it offers!
Comment #9
cpliakas commentedSounds like a solid approach to me. And nobody really knows all that CTools offers :-). I have about 15% of it down, and I think I am ahead of the curve. The big piece for me is that the plugin definitions accept keys that help with autoloading. Check out the ctools_plugin_get_class() function for the keys that are supported OOB. The D7 version doesn't use them because of the built-in Drupal autoloader.
Another cool piece is the export_ui component. Ckeck out the Current Search blocks module and you will have wished the Apache Solr search pages piece leveraged it :-). Pretty much gives you exportables and a UI shell OOB. Really cool stuff.
Comment #10
nick_vhCommitted this patch as a initial start then :-)
Comment #11
nick_vhMenu adjustments. All menu items should be accessible and at least show some configuration form now.
Still some errors and having problems with drupal_render_children. Should find some alternative for this
Committed this patch to the branch, so if you want to help. Feel free!
Comment #12
nick_vhFacet blocks are working!!
Some unfortunate backport magic removed the drupal_html_class function because it does not exists in Drupal 6. I don't think we should support this problem for Drupal 6. There are still some notices but screenshot should make clear that at least the basics are working
Comment #13
nick_vhLess notices and errors. Pages start to look better :-)
Comment #14
cpliakas commentedGreat progress! Pretty exciting stuff.
Comment #15
nick_vhPatch 13 + some small changes added on
Comment #16
nick_vhSmall path update
Comment #17
nick_vhMore small path fixes + some protection for a mapping function. Not sure if this should be ported to 7.x (not committed yet to the branch)
Comment #18
cpliakas commentedWhy did you need to add protection in the mapping callback? At one time mapping callbacks weren't invoked if there were no values to map, however a few resolved issues come to mind that could have broken this logic as an unwanted side-effect. If the mapping callbacks do require protection, maybe we should post a bug and apply a fix to the FacetapiFacetProcessor::mapValues() method for a catch-all solution.
Comment #19
nick_vhThe function gave me a SQL error. Which seems like an empty array to me. It happened when I added a CCK field, configured the facet. Added the block to the region and executed the search page. There was no value indexed for this facet and there was no content in the database for this facet. Somehow it broke. More about this later on
Comment #20
cpliakas commentedExcellent. Great find! Sounds like a Facet API bug to me :-(
Comment #21
cpliakas commentedRe #19, someone posted a bug against the 7.x version at #1399706: Mapping callbacks are invoked when there are no values to map leading to fatal errors in some callbacks confirming this issue for all versions of Facet API.
Comment #22
cpliakas commentedHow are we handling the #states property in D6?
Comment #23
nick_vhI haven't backported that yet. Next big thing is to convert all queries to normal queries starting from now. Suggestions on the #states are welcome?
Added patch to convert some of the D7 paths to D6
Comment #24
nick_vhConverted most of the dbtng queries to regular queries. I'd like to hear your comment on autoload dependency. It does make class loading way easier and in sync with the D7 version.
Comment #25
nick_vhI am not able to let simpletest run because some of the classes are not loaded properly. I expect this has something to do with ctools but I have yet to figure out why and how it fails in simpletest
Comment #25.0
nick_vhUpdated issue summary.
Comment #26
iTiZZiMO commentedjust an issue from dev today while clicking the facet link in the apachesolr (also dev 6x.3x from today):
Fatal error: Call to a member function getFacetSettings() on a non-object in /usr/share/drupal6/sites/all/modules/facetapi/facetapi.admin.inc on line 68
i will try to fix it
Comment #27
gnucifer commentedPerhaps a bit late, but couldn't perhaps this module be utilized to keep the dbtng-queries from the 7.x-version, making the version easier to keep in sync: http://drupal.org/project/dbtng ? Also, is there anything I can do to help? Perhaps have a look at #states? Need to use apache solr intregration 6.x-3.x and right now, without a d6 port of facetapi, it seems quite broken.
Comment #28
cpliakas commentedThanks for the post, gnucifer.
That is actually what the initial backport used, but my opinion is that we should avoid using a backported DAL if possible. It adds a lot of code and introduces the possibility of more bugs, which probably outweighs the effort required to use the D6 DAL and negotiate any differences in code that has to be backported. The module isn't database heavy from a functionality standpoint, so we shouldn't have to do too much. I do think it is a good thought grounded in solid reason, but that is my $0.02.
I'm sure your help would be welcome, and thanks for offering! Nick_vh is the maintainer of the 6.x-3.x branch, and minus backports of fixes to the 7.x version I am taking a hands off approach simply due to a lack of time that I can dedicate to this. I will let Nick coordinate any efforts towards the 6.x-3.x branch. As a general thought, It might be helpful just to install the latest code from the git repository and see what is not working. I'm sure a lot of action items will make themselves clear.
Thanks again,
Chris
Comment #29
gnucifer commentedAh, yes in that case it sounds like the best decision porting dbtng to the D6 DAL. I will clone the repo tomorrow and start looking at what I can to to contribute.
Comment #30
gnucifer commented@xeconsulting: Installing http://drupal.org/project/autoload seems to resolve this problem (and probably all others related to d7-autoloadning). Perhaps that should be added as a dependency? Haven't looked at it much, but perhaps it's preferable to using ctools for this purpose?
Comment #31
gnucifer commentedReplaced call to "drupal_get_query_parameters" and fixed a minor comment inaccuracy(?)
EDIT: Hmm, saw this issue was addressed in 1387164-25.patch, sort of a bug in that code thougth, calling drupal_get_query_parameters within the added fetchQueryParams method. Currently no execution-path goes there, but should still be fixed. I though it a bit overkill to copy all of drupal_get_query_parameters since we don't need to filter out sub elements of query parameter arrays.
Comment #32
iTiZZiMO commentedThank you very much gnucifer
The FaceAPI works now and i can active the facets under my search enviroment.
Unfortunately i cannot configure display or export it (actions related to facet field) -> i get always an:
Class name must be a valid object or a string in /usr/share/drupal6/sites/all/modules/facetapi/plugins/facetapi/adapter.inc on line 137I will try to analyze it but i'm not familar with the code right now..
Comment #33
nick_vhWe'd love to keep the amount of dependencies to a minimum. This means that if possible, autoload will not beome a dependency but we will implement some smart loading scheme if possible, Same reasoning is valid here as for the dbtng module :-)
Comment #34
gnucifer commentedYeah, I'm using it for now though. Seems like a high quality module, and with 15204 and only a few minor issues it seems relatively safe when it comes to possible bugs. Would be great if the last patch (#25) could be committed to 6.x-3.x so I can get started working on the current issues. I guess I could merge them into my working copy, but I guess it's not ideal since there will probably be more possible merge later on conflicts if I do so.
Comment #35
nick_vhCommited comment #25
Comment #36
nick_vh@gnucifer, even though I like your patch I am a bit surprised to see that this is a D6 only problem? Can we track this in a separate thread?
I'm thinking about closing this one and opening separate issues per problem from this point on
Thanks!
Comment #37
nick_vhAnd for the record, we'll keep autoload in the loop since it is only giving us advantages and the high amount of users seem to indicate it won't give us lots of troubles in the near future
Comment #38
gnucifer commentedOk, thanks for the commit! I will start working on the tasks for the d6-port and post updates in this thread.
Comment #39
nick_vhAdding the patches to get simpletest working also in this queue
Comment #40
nick_vhCommited patch #39, 1 more fail left! Has something to do with ctools_static
Comment #41
cpliakas commentedGreat work, guys!
Comment #41.0
cpliakas commentedStrike through of the items that have been done
Comment #42
nick_vhLatest one fixes all simpletests - we can now continue to work resolving other issues
What's left?
Comment #43
nick_vhCommitted #42
Comment #44
nick_vhSmall SQL issue from the dbtng backport
Comment #45
nick_vhDependency UI was not working because a non existing get_entity_info function
Comment #46
nick_vhCommitted 44 and 45
Comment #47
gnucifer commentedSorry about my inactivity, work has kept me busy. Thanks @Nick_vh for the recent commits! Now when I finally have the time I will try to make myself useful.
Comment #48
gnucifer commentedI'm currently working on the ctools-class autoloading. Clicking on "Configure display" gives me the error "Class name must be a valid object or a string" in adapter.inc on line 137 because ctools_plugin_load_class fails. Have sorted most of it out, but will not have time to get a patch ready until tomorrow.
Comment #49
nick_vhCan't wait to see progress on that! It's a hard nut to crack :-)
Comment #50
gnucifer commentedYeah, it was a bit more hairy than expected. I'm testing against the apache solr integration module and seems like there are some issues with ctools-autoloading there as well. Got it working with autoload module enabled (the issue in my above post traced down to facetapi.facetapi.inc being included to late in hook_init), but tomorrow I will hopefully upload a patch mostly getting rid of the autoload dependency.
Comment #51
gnucifer commentedNow working without autoload. :) Had to patch apache solr search as well, as the ctools plugin declaration were incomplete. Will post that patch in the apache solr issue queue in a moment.
Comment #52
gnucifer commentedOops, uploaded the wrong patch. :/ This is the correct one:
Comment #53
nick_vhIs the first patch the patch for apachesolr? Care to explain why?
Comment #54
gnucifer commentedPatch for apachesolr: http://drupal.org/node/1485404
Comment #55
gnucifer commenteddouble post
Comment #56
gnucifer commented@Nick_vh No I accidently uploaded the wrong patch in #51. Just ignore that file. The patch for facetapi is in #52 and apachesolr in #54.
Comment #57
nick_vh@gnucifer, are you able to run the simpletests with this patch? That would be awesome!
Comment #58
gnucifer commentedHow does the simple-testing on drupal.org work? I ran the test suite on my setup and all tests passed. I saw autoload module is loaded in the test setup though, so problems with ctools autoloading will probably not be caught.
Comment #59
gnucifer commentedSorry about the spam, just not sure how drupal.org triggers the automated testing. This obviously didn't work.
Comment #60
nick_vhWhat does this patch add? :-)
You can remove autoload from the simpletests to run all of them and hopefully they still work
Edit :
Automated testing won't work for patches until the module itself has been validated. So we should stick with local testing until then.
Comment #61
gnucifer commentedWithout the patch I can't get facetapi to work with apachesolr-module. Even with autoload-module turned on I got the error reported in #32. What this patch does is fix that issue, plus adds more meta-data for ctools so it can figure out how to load the classes, and possible parent classes (the file and path-info on handlers). With all these changes in place, the autoload-module is no longer needed. I will have to recheck the tests without autoload enabled though.
EDIT: Short summary of changes.
- Added missing 'file', 'path' and 'parent' to all ctools plugin handlers.
- Added ctools class loading where missing in some place or two.
- Added ctools plugin declaration also for abstract plugin handlers (for autoloading of parents to work).
- Removed function facetapi_ctools_plugin_type because as I understand it they should be declared as facetapi_ctools_plugin_adapters,
facetapi_ctools_plugin_dependencies and so on. The 'type' is just a placeholder for plugin type, not in the name of the hook which is pretty confusing. I had to read the ctools source-code to get this (as for most ctools-functionallity).
- Don't know if because hook-execution order, but had to replace:
with
or the hook declarations are not picked up by ctools. Pretty weird actually.
Comment #62
nick_vhStill seems that most of the tests fail without autoload :
22 passes, 16 fails, and 1 exception
Comment #63
gnucifer commentedYes, and mostly it is because the plugin-declartions in facteapi_test.module have the same problems as the ones fixed in facetapi.facetapi.inc. Adding path, file and parent for them resolves all issues for me besides loading of the query_type plugin. Having a look at that now.
Comment #64
nick_vhYeah!
28 passes, 0 fails, and 3 exceptions
Thanks gnucifer for building the first brick. Working on those exceptions now
Comment #65
nick_vhRe-uploading the patch. Working with some new files
Comment #66
nick_vh222 passes, 0 fails, and 0 exceptions
I would like to get rid of the include_once though. Will try to work on that now
Comment #67
nick_vhThis moves the code to hook_boot, little bit better. Also removed debug calls
Comment #68
nick_vhGoing to commit this patch. Please open up a new one if you find other issues.
Comment #69
gnucifer commentedAh but of course! The error I was getting was struggling with in the test case was caused by the test adapter and query-type residing in the same file, so when the first was loaded PHP complaines about a missing parent class for the other that failes to be included. Splitting them up in two files as you have done in the latest patch resolves this. :)
Comment #70
gnucifer commentedYes, I will continue working on testing the module together with apachesolr.
Comment #71
nick_vhCommitted to D6 branch
Comment #72
gnucifer commentedPersonally I think its better to include the code with require_once, hook_boot is problematic because I believe it registers the module as having to be loaded by drupal also on cached requests, and as incompatible with aggressive caching.
Comment #73
nick_vhgnucifer, you have some documentation to proof that? If so, make a patch and we'll revert that
Comment #74
gnucifer commentedIt's not very well documented, but in http://api.drupal.org/api/drupal/includes%21module.inc/function/module_r... this code sets the boostrap-flag for modules implementing hook_boot (before inserting into system table):
Comment #75
gnucifer commentedPatch reverting to include files the old way:
Comment #76
nick_vhCommitted! :)
Comment #77
gnucifer commentedSome more fixes in facetapi.callbacks.inc:
Comment #78
gnucifer commentedoops, wrong thread :) ignore this comment
Comment #79
dandaman commentedI'd admit I haven't read all of this thread, but what of the 6.x-3.x-dev version does work? I've got Apache Solr installed and showing its basic facets, but I don't see any settings pages that expose the Facet API blocks. Does more support have to be put into Apache Solr 6.x module or something? Thanks for all the great help and useful code.
Comment #80
dandaman commentedOhh, I'm figuring this out. Latest update: I should be using the 6.x-3.x version of the Apache Solr for the Facet API to work. That makes sense. I'll have to see if moving to Solr 6.x-3.x from 6.x-1.x is trouble or not.
Comment #81
gnucifer commentedNew patch fixing settings for empty behaviour text:
Comment #82
nick_vhComment #83
gnucifer commented@dandaman: Yes it might work with latest dev 3.x-branch of solr and facetapi, it does for me. For taxonomy-facets to work some uncommited patches are needed though.
Comment #84
nick_vhGnucifer, could you move that to another thread and close this one? I'd like to keep track of different issues in different pages
Comment #85
gnucifer commentedAh, thought we where doing all the backporting in this thread, but I should post the patches in new issues instead?
Comment #86
nick_vhOriginally yes, but it is becoming a bit unclear for me what patches are a follow-up for what. Hope you don't mind creating new ones. I'll keep this thread for todo's :-)
Comment #87
nick_vhComment #88
gnucifer commentedYes, np. Will create new issues as soon as I'm done with some other stuff.
Comment #89
nick_vhCommitted to 6.x-3.x dev.
Thanks for your contributions! For new stuff I'd like you to open a new issue.
Comment #90.0
(not verified) commentedUpdated issue summary.