I'm not entirely sure if this is a problem in the Top Searches module or the Drupal core, but if a user searches for "CEO", the top search block will only show "Ceo" as a popular search. Any clues on how to fix this without breaking everything?

Comments

z.stolar’s picture

Category: bug » feature
Status: Active » Closed (works as designed)

Drupal's core, as most of other search engines, is case insensitive.
In order to keep the list of search phrases to minimum, Top Searches also renders everything as lowercase words, with first letter capitalized. This also makes a better looking list.

I guess we could add an admin option to maintain the case, but this will only be the case for Top Searches, not Drupal core, on which the module relies.

Anonymous’s picture

Priority: Normal » Minor

Well that seems like a nice option to have, so when I get some free time over the holidays I'll sit down and see if I can implement that into something. I know I'm not the first person to have this issue with Drupal as a whole, so I feel like it wouldn't be time wasted. I'm a good PHP programmer but I am sadly not very acquainted with module development using Drupal quite yet. Do you maybe have a suggestion of the best angle to attack this? It is obviously very inefficient to store case into a database, so maybe a tool that would:
- intercept the output from Top Searches
- display it in a configuration page and allow the values to be customized (heck even let the admin filter out popular searches that they don't want in the block)
- output to the block

As I said, I have never made a Drupal module, so this could be a very hamfisted way of approaching this - heck it may be easier just to make up my own list of popular searches and customize it 100%, but that's no fun! I would love to contribute to something that has made my life so much easier, so any tips on getting something like this off the ground would be much appreciated.

z.stolar’s picture

Again - the search itself is case insensitive, and that's a Drupal core issue. I don't see it changes, but you can go ahead and try.
Remains the question of configuring TS to keep the original search. Look for "beautify" in the module's code. that's where it happens.
You should also add the necessary lines in topsearches.admin.inc to allow the admin to choose the behavior.

Anonymous’s picture

Ah that looks like what I am looking for so I'll see what I can do with this when I get some free time. Thanks for your help.

Anonymous’s picture

Status: Closed (works as designed) » Closed (fixed)