Maybe this is a bug, I'm not quite sure.
Basically the problem exists in that if you have a large set of terms you are creating your cloud from (say 100+ or what not) but only want to display 20 of those terms, there appears to be a break down in the logic.
Instead of getting 20 randomized terms from all 100 terms you get the top 20 terms (alphabetically) and then only those are randomized. So I end up with tag clouds of only terms with A-C being randomized.
Sorting by date doesn't appear to have any effect on views cloud in general, nor does the additional global random filter do anything to change the results.
Am I doing something wrong or is this a problem in views cloud? I've tried all sorts of different methods without much luck either way.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | views_cloud_summary_sort.patch | 2.58 KB | quicksketch |
| #5 | tag_cloud.jpg | 152.24 KB | chaimkut |
| #5 | tag_cloud.txt | 3.1 KB | chaimkut |
Comments
Comment #1
fawkstrot commentedIn the first paragraph I mean "but only want to display 20 of those terms RANDOMLY", just for clarification.
Comment #2
ivanckt commentedI got the same problem. You can reproduce the problem by setting the maximum number of tags to 1 or 2, then you will see everytime you refresh you get the same tags. I want them to randomly choose from all tags.
Comment #3
quicksketchYou just need to add the "Global: Random" option to the "Sort Criteria" section. The Randomize option within Views Cloud only randomizes the items it's given, you need to tell the entire view to return random items.
Comment #5
chaimkut commentedHi
Using 6.x-1.1 posted on Nov-18-2009.
For some reason I can't get this to work. I create a simple View using the instructions in the README and then I added a 'Sort criteria' of 'Global: Random asc' but this does not have the desired affect. The exported View is attached. Basic elements of the attached View:
-Filters - Taxonomy: Vocabulary - attach multiple vocabularies (let's call them instrument_vocab, color_vocab, animal_vocab etc.)
-Arguments > Taxonomy : Term ID > Cloud : not Randomized (for simplicity)
I've also attached a screenshot.
The basic result is the following --
A list of terms concatenated from all of the Filtered vocabularies (good), but only from the first X (10 in this case) terms in alphabetical order appear. So for instance, I get 3 terms from vocab1, 4 terms from vocab2, 3 terms from vocab3 but they're all beginning with the letters 'a' or 'b' and nothing from later on in the alphabet. For instance, aardvark, accordion, air horn, alligator, ant, aqua, auburn, bagpipe, bassoon, beige, blue
Desired result: A concatenated list of ALL terms from vocab1, vocab2, etc. randomized -- and take 10 from that list to display in a Block. For instance, aardvark, aqua, bagpipe, flute, giraffe, green, magenta, peacock, tiger, yellow
My impression is that the option Arguments > Taxonomy: Term ID > Action to take if argument is not present: Summary, sorted ascending
is overriding the "Sort Criteria" > "Global: Random". If I change "Action to take if argument is not present:" to "Summary, sorted descending" then my returned list is all terms starting with z's and y's. It seems that sorting is the definitive one that is being used.
Any suggestions?
Thank you.
Comment #6
fawkstrot commentedThis isn't fixed and has the same behavior with Global: random. It only randomizes from within the alphabetized return list. It only randoms, for example, results from within A-F, rather than A-Z.
Comment #7
pydubreucq commentedHi,
I have the same problem.
I would like to display a views cloud with term sort by weight...
I've added the global sort criteria but nothing work...
I've put the priority as critical, because I think a cloud with just the first term classified with alphabetized return list is not a real cloud...
Thanks by advance...
Bye
Comment #8
quicksketchAs far as I know, no one is actively working on Views Cloud. I'd suggest filing a patch (or hiring a developer who can) and then one of the maintainers (eaton or I) will have a look at the suggested change. As far as I can tell, the "Global: Random" sort not working seems to imply that something broader is wrong, since that sort should work on every view, regardless of it being a "Cloud" view or not. It should also be unaffected by Views Cloud entirely, since it's at the query level and Views Cloud is simply a display of the returned items.
Comment #9
Mikeq commentedI am a relative newcomer to Drupal, and a complete php coding neophyte, so apologies in advance if any of the following breaches protocol and custom; feel free to set me right.
I have also been wrestling with this problem for a while. Following a lead from this thread: http://drupal.org/node/417312, the problem appears to be as follows:
View cloud uses arguments to retrieve the cloud content, relying on the argument summary behaviour to count occurances of each term, which is then translated into tag size in the cloud view.
Views (6.x-2.8 and earlier) imposes a sort on argument summary views when no argument is passed, and this is coded to explicitly disable the views sort. This explains why sort global:random appears to have no effect wheresas argument summary:sort ascending and argument:sort descending do.
Take a lead from thePanz (http://drupal.org/node/417312#comment-1474502) I stole the code to add a new argument summary sort order, summary:sort as view.
Having defined a new summary sort (effectively no sort), this is later used to prevent the summary sort being executed, and also prevent the view sort being disabled.
The changes to the views 6.x-2.8 views_handler_argument.inc look like the following (apologies - I have access to only a limited set of dev tools):
A couple of additional points.
The view:distinct must be yes - this seems to force the argument summary to count the occurance of terms rather than inserting each term once into the view.
The view cloud:randomize option is not needed, this is provided directly by using sort global:random.
I use the view Items to display: to limit the number of terms shown in a cloud (not the override in the view cloud settings).
The above seems to work well for me, generating a random subset of all tags for the cloud, different at each page load. I have not seen any adverse side effects with other argument summary views so far.
Comment #10
andyf commentedsubscribe
Comment #11
quicksketchI apologize everyone. I think Mikeq is right on here:
So in other words the summary displayed is not affected at all by the "Random" sort, since the summary isn't affect at all by any sort criteria. The summary query is completely independent of the one built by the user.
I've applied this patch to correct the problem (all summaries now default to sorting by item count) and I'll make a new release once I have another look through the active issues.
Comment #12
pydubreucq commentedHi,
I've updated this module.
The randomize work nice for me ;)
Thanks a lot ;)
Bye