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!

CommentFileSizeAuthor
#4 search_api_db.facets.patch5.98 KBdrunken monkey
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey’s picture

It 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.

patrickharris’s picture

I'd be very interested in this too.

drunken monkey’s picture

Component: Facets » Database search
Priority: Minor » Normal

Now on to this. Status: awaiting a response in #1068316: Create temporary table from complex select query. Anyone good in DBTNG in here?

drunken monkey’s picture

Status: Needs review » Active
FileSize
5.98 KB

Thanks 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!

drunken monkey’s picture

Status: Active » Needs review
patrickharris’s picture

Status: Active » Needs review

This 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 of return $value == 'true' ? t('True') : t('False');.

patrickharris’s picture

Also, selecting 'false' for a boolean search was not working. Changing line 602 from if ($filter) { to if (isset($filter)) { seems to fix it.

drunken monkey’s picture

Thanks 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.

drunken monkey’s picture

Status: Needs review » Fixed

Since 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.