3

Currently I have setup a view to display custom search results based on search terms (exposed filter):

/blog/search?keys=user+entered+term

On the page I am looking to show a list of tags with counts based on that search term, for example:

Code (x)
Tutorial (x)
Help (x)

A block has already been created in the view with the following:

CONTEXTUAL FILTERS
(term) Taxonomy term: Name (-> display summary with count)
RELATIONSHIPS
Content: Taxonomy terms on node
FIELDS
(term) Taxonomy term: Name

While the above does output the taxonomy terms, it displays the counts for all of the taxonomy, rather than filtering it based on the search term.

Seems like I am most of the way there, but would appreciate any thoughts/suggestions anyone could offer.

1 Answer 1

0

Contextual Filter Wont do here. Please follow these steps:

  1. Add another field "Taxonomy:term name".
  2. Under the advanced settings tab, turn on SQL Aggregation.
  3. Edit the sql aggregation settings against the newly added field "taxonomy term" to make it "COUNT". Not "COUNT DISTINCT" remember.
  4. If there is any sort option, please remove it for this to work. Let the filter remain as it is.
  5. Now you will have taxonomy tags, with the number of nodes against each.
6
  • Unfortunately this didn't work and just output 1 total number. I removed the contextual filter, as well as the sort options, keeping the existing relationship and set the aggregation on the taxonomy term field to 'count'
    – Steve
    Oct 10, 2013 at 11:52
  • So What all fields are there at present?..can you post a screenshot of your views screen?..this did work for me.
    – Neo
    Oct 10, 2013 at 12:08
  • here you go: troll.ws/image/0997d4c0#.UlalfmRAQ98
    – Steve
    Oct 10, 2013 at 13:04
  • I am evaluating. Here is a quickie: Please dont apply COUNT on both the fields. One taxonomy term field should be without count and other should be with count. Please change this and let me know. Till then I am looking into the screenshot.
    – Neo
    Oct 10, 2013 at 13:14
  • troll.ws/image/81278f53#.UlaqxmRAQ98 v2 with count on 2nd taxonomy:term name field (the first is set to group, no option to disable) This is appearing as before with the Contextual Filter, however I need it to filter nodes based on the search term from the search results page (also within that view).
    – Steve
    Oct 10, 2013 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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