6

I'm using Super Search (2.1.2) as a channel:entries replacement. I'm finding that super_search_total_results is wrong when I use search: parameters. A stripped down example:

{exp:super_search:results
  channel="files"
  search:files_area="=schedules"
  search:files_type="not digital"
}

I should have 5 results, but super_search_total_results give me a result of 8, which is the count of all items in the files channel, including the digital items. I am seeing only five files (which is right), but the total results result is incorrect.

If I use a query string instead:

search&files_area=schedules&files_type=-digital

I get 5 items showing and the correct count of 5. I don't always want to put a monstrous query string in the URL if I don't have to, because I don't want someone trying to manipulate it. Also, I don't think I can do an "if empty OR a specific value" in the query string like I can do with this (and will need to do on this site as well):

search:files_company="IS_EMPTY|{member_company}"

Is there something I'm missing as far as getting the correct total results count when using those search: parameters?

For anyone coming here with the same issue: I downvoted the initial answer because it doesn't actually answer the question(s).

I just found this comment in mod.super_search.php on line 1261 (SS v2.1.2):

//  If someone uses the search:body="something" template param, the counts 
    can be thrown off. This conditional is a patch that will catch some of the cases.

Someone there knows about using the "search:" parameter style, and knows that the counts can be off. I don't think the patch is working, obviously.

7

I don't know why this didn't occur to me before, but you can use {absolute_results} inside the Super Search tags. So, the lesson here is, if you need to use the channel entries style "search:field=" parameter to filter entries (NOT the Super Search "search=" parameter) and you need an accurate number of items returned, use {absolute_results} in place of {super_search_total_results}.

One trick to note about this is that {super_search_total_results} is available anywhere on the results template, but {absolute_results} is only available inside the Super Search tags. Depending on how your template is laid out you may have to use Stash to put your {absolute_results} where you need it. (Stash on devot:ee: http://dvt.ee/stash)

1

The syntax for SuperSearch is a little different. ref http://www.solspace.com/docs/super_search/results/#search

Something like: search="keywords=green&channel=products&category=pants+shirts&status=-closed&orderby=title+asc&limit=100"

The usage of the "search:" parameter is a current limitation in Super Search. Because Super Search uses the Channel Entries API, it does by default "work" when you try to use "search:stuff" parameters, however Super Search does not account for this in the {super_search_total_results} variable. This is not quite a bug, though I agree it seems like it could be easily supported/added in and be a valuable addition.

Can you submit a Feature Request for it here: http://support.solspace.com/support/discussions/forums/213813

3
  • But then we can't override any of those in the URL if we had to, right? (from the docs: "This method will override any Super Search query through POST as well as any query through the URI.") And how would we do the equivalent of "IS_EMPTY|{member_company}" in the URL, which will be sort of critical on Aug 30 '13 at 13:33
  • It's funny that we can use the "search:" parameter and it will work and filter down to the correct number of returned entries as I'd expect, but it doesn't seem to be supported at all. Aug 30 '13 at 14:14
  • I updated our response above :)
    – Solspace
    Sep 10 '13 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.