Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Are you planning to implement this? Those of us who depended on Faceted Search are left without a D7 solution. In my case, I cannot use solr on shared hosting and my site doesn't have enough traffic for the speed of the database to matter much.
Thanks for all of your work on this module!
Comment | File | Size | Author |
---|---|---|---|
#4 | search_api_db.facets.patch | 5.98 KB | drunken monkey |
Comments
Comment #1
drunken monkeyIt would definitely interest me to do this as it doesn't look too hard in principle and really would be a cool addition. More so as I now know that the Faceted Search module won't be ported.
Problem is that I really have little time at the moment, and what I have already goes to several other issues. The database backend sadly has been a bit neglected lately, there are even some issues with normal searches (even though they appear only in edge cases).
I'm sure I'll do this at some point, but if someone with a little experience and time on his hands would volunteer to help out here, I'd be more than glad to give them some tutorial and my ideas on the matter.
Otherwise, we could just wait if more people show up wanting this feature; if there really are several I should be able to squeeze work for this in somewhere.
Comment #2
patrickharris CreditAttribution: patrickharris commentedI'd be very interested in this too.
Comment #3
drunken monkeyNow on to this. Status: awaiting a response in #1068316: Create temporary table from complex select query. Anyone good in DBTNG in here?
Comment #4
drunken monkeyThanks to Damien's quick answer, the patch is already done, and seems to work perfectly for me.
Please review!
A quick overview of the implementation: all result IDs are dropped into a temporary table, then for each facet a query is run, joining that temporary table with the value table for the respective facet field, with a simple
SELECT value, COUNT(DISTINCT item_id) AS num …
.If someone has a large/huge dataset it'd be great to get some feedback on the performance. General comments on how this might be improved performance-wise are of course also welcome!
Comment #5
drunken monkeyComment #6
patrickharris CreditAttribution: patrickharris commentedThis looks fantastic, and appears to work brilliantly! However a boolean like 'published' or 'promoted to front page' doesn't work.
I think line 911 in search_api_facets module should be
return $value == 1 ? t('True') : t('False');
instead ofreturn $value == 'true' ? t('True') : t('False');
.Comment #7
patrickharris CreditAttribution: patrickharris commentedAlso, selecting 'false' for a boolean search was not working. Changing line 602 from
if ($filter) {
toif (isset($filter)) {
seems to fix it.Comment #8
drunken monkeyThanks for testing, and for spotting this, these really are bugs in the current code! One even shows with the Solr-based facets, as I now found out …
I opened a different issue for those, as they merely were revealed by this issue, not caused by it: #1071894: Boolean facets are handled incorrectly.
Comment #9
drunken monkeySince the facets code in the database backend seems to be fine, I just committed it.
A new Beta 6 release will be created soon, probably tomorrow, containing this new feature.