As per the post at http://drupal.org/node/384952#comment-4481748, the API should be changes so that facets define a set of query types as opposed to a single one. This will require that the definition be changed to "query types" and accept an array of types. This will need to be coordinated with Apache Solr.
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | 1161434-25.patch | 18.66 KB | nick_vh |
| #21 | facetapi-1161434-21.patch | 18.71 KB | nick_vh |
| #20 | facetapi-1161434-20.patch | 21.88 KB | nick_vh |
| #19 | facetapi-1161434-19.patch | 18.55 KB | cpliakas |
| #16 | facetapi-1161434-16.patch | 18.78 KB | cpliakas |
Comments
Comment #1
cpliakas commentedPostponing, because this needs to be vetted out further.
Comment #2
cpliakas commentedThis task is important and related to #1176814: Re-implement the widget requirements system. Assigning to myself since development of this issues are so intertwined and critical to the low-level architecture of the module.
Comment #3
cpliakas commentedMarking as a beta4 blocker.
Comment #4
cpliakas commentedAdding new tag to track backwards compatible API changes. Legacy code should be removed when the module goes 1.0.
Comment #5
cpliakas commentedChanged my mind. There are more important fixes that should be released ASAP.
Comment #6
cpliakas commentedThis is a stable release blocker that prevents the fieldset realm from being implemented. In other words, this prevents the creation of widgets that depend on different query types.
Comment #7
nick_vhAn initial stab to the problem
It took me a long time because figuring out the architecture just by debugging it wasn't easy
What is allows you is to install a widget and the widget can tell facetApi for what queryTypes it is working.
An example can be seen with facet_slider and adding the patch #1316268: Query Type Example restriction (follow up on apachesolr and facetapi)
There is a known (severe) bug. It will allow you to select the widget but it will not show up because I'm too tired to keep debugging for the evening :-)
I guess that someone familiar with the api will see the problem. As far as I know the problem lies in the widget. (http://drupal.org/sandbox/cpliakas/1160920)
Comment #8
nick_vhSome bugfixes - everything is working in regards to FacetApi.
I'd like a brainstorm session in regards to the use of realm in most of the functions. This queryType selection will only work when the module that is retrieving the filters does something like this
As you can see the module (in this case apachesolr) tells facetapi which realm it wants. If it doesn't do that it will return the facets as defined by default and could in some cases return unwanted results.
I don't think there are any other side-effects for other modules (searchapi) by applying this patch since I tried to work towards backward compatibility and sensible defaults.
Comment #9
cpliakas commentedHi Nick.
Thanks for taking a crack at this difficult problem. My comments are listed below:
In terms of our conversations on the side, we may have to resort to adding the query type as a global setting.
Thanks,
Chris
Comment #10
nick_vhGreat comments,
I tried to cleanup the patch as good as possible so it only reflects the changes that have to be made
The key has been changed to query types in the facet defintion. However, in the widget it stays query type
Widget definition :
The numeric_range requirement could disappear, but I found it to be flexible enough so more reviews on that are welcome
Also the query type is now global, so we should still add some notification if there are multiple realms and conflicting widgets...
Comment #11
cpliakas commentedGreat work. This definitely looks better. I will try to apply the patch and test it out.
Thanks for your hard work on this,
Chris
Comment #12
cpliakas commentedI am marking this as needs work for the reason that the addActiveFilters() and process() methods are realm agnostic and only run once. If we make these realm specific then we are are missing out on some data. For example, let's say the "bundle" facet is active in the fieldset realm, but not in the block realm. If the block realm is processed first, then since those functions are only processed once the "bundle" facet won't have the data it needs in the fieldset realm. If you take a look at the application flow in the comment at http://drupal.org/node/1302590#comment-5091284, nothing in the one time processing list should be tied to a realm. Only tasks related to the widget should have realm parameters or context.
Comment #13
nick_vhUpdated with some changes towards your comments.
The only realm reference I left is in
Comment #14
nick_vhYeah a better update!
A big bug was fixed in this patch, namely that the facets disappeared whenever they were selected. This version also takes into account that if the build from the facet didn't return a value it will render the empty_behavior plugins.
Please try it out with the facet_slider and apachesolr module (see links to the respectively module and issue page in the comments above)
Comment #15
nick_vhComment #16
cpliakas commentedI started the query-types for work on this. The attached patch takes some of the concepts in the patch above but reworks the logic a bit to handle this in a slightly different way. Also adds a validation handler so people can't configure settings that don't make sense.
Comment #17
nick_vhI like the getSettings change, it makes it less obfuscated and at first sight you added more export options? A list of what you've done would be useful.
Comment #18
cpliakas commentedSure thing. The bullet list is below:
Regarding moving the FacetapiAdapter::getSettings() method to the adapter, I had to do this since the settings now need to be loaded while the adapter is being instantiated. I took the opportunity to break the method into two settings in order to eliminate a big if / else block that was ugly looking and hard to follow at first glance. The functionality is the same, it was just moved and refactored a bit.
Comment #19
cpliakas commentedRevised patch removing some extra, unnecessary code in the adapter's constructor.
Comment #20
nick_vhIt wasn't working as I expected with the facet_slider
There were some mistakes in regards to the retrieval of the query_type but should be fixed now. Using this patch in a demo tomorrow so I'm marking it as reviewed in the hope that it gets committed ;-)
Comment #21
nick_vhPatched against wrong version. Correct patch now
Comment #22
nick_vhSo for me this is ready to go! I already modified facet_slider to work with these recent changes
Comment #23
cpliakas commentedYour differences are good. The two things I would change are building the $query_types variable via drupal_map_assoc() and still build the #options with
array_map('check_plain', $query_types)to be über-paranoid about security. Other than that this is RTBC.Comment #24
cpliakas commentedRemoving myself from the "Assigned" tag since Nick is doing most of the work here.
Comment #25
nick_vhFound some other major bugs in regards of passing a facet Array instead of an facet object.
Also the drupal_map_assoc should be solved
Comment #26
nick_vhSeems like this breaks OR facets. Still have to confirm if it is this patch that breaks it or the apachesolr patch
Comment #27
cpliakas commentedExcellent! Thanks for rolling this. Will test and marking as "needs review".
Comment #28
cpliakas commentedI tested the OR facets, and everything works fine for me. Great work, marking this as RTBC.
Thanks, Nick!
~Chris
Comment #29
cpliakas commentedResolved in commit fb1d0b5.
Congrats on becoming the 9th committer to Facet API!
Comment #30
nick_vhCool! Great news to see this committed