avoinministerio/avoinministerio — pull request #157 by jyrkive (2012-06-14 08:13:03+00:00)
Title: Search improvements

These commits provide multiple improvements to searching:

+ results are now paginated, shortened and highlighted
+ results are easier to read because links are now black rather than blue
+ comment links lead now straight to the comments instead of just the ideas
+ result count has been added (most importantly, if there are no results, "0 tulosta" will be displayed)
+ headings ("Ideat", "Artikkelit", "Kommentit" and "Kansalaiset") are no longer displayed if there aren't visible results under the heading (makes paginated search feel better)
+ result clicks are now tracked (to help us improve result ordering)
+ hidden articles, ideas, comments and citizens can't be displayed any longer

Technically my implementations are suboptimal. For example, highlighting is implemented by escaping result body, inserting HTML and finally outputting the string unescaped. It would be better to use Markdown, especially given that comments can contain Markdown syntax. Nevertheless, my implementations are working (for me) and Aleksi has said that he wants these improvements quickly into production.