The following file (start.php) and a manifest file comprise the plugin "search_extension"
The core plugin "search" displays tag results only if the inputted string matches the tags exactly and completely
However, the following code overrides it by displaying the tag-search-results even when the searched string is a substring of the tag
ANY IMPROVEMENTS/FEEDBACK IS HIGHLY APPRECIATED.
Why this isn't posted as a plugin yet:
From the comments, it seems that there is work and improvements already on its way by the core developers. I am hopeful to have this worked out in the future versions of the Elgg thereby not requiring this at all. Or else, if not, I look forward to some feedback before posting it as a plugin
mod/search_extension/start.php:
https://gist.github.com/2362199
mod/search/search_hook.php:
https://gist.github.com/2362289
Diff of the functions from the above 2 files:
http://www.diffnow.com/?report=5uzrk
(in case the above link does not work: the site I used for diff was:http://www.diffnow.com/)
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Steve Clay@steve_clay
Steve Clay - 0 likes
- ElggCloud@g2w!
ElggCloud - 0 likes
You must log in to post replies.In particular Deepa (and I) want to know if there's a downside to using the LIKE expression when matching against the tag names (here on line 90)? Was this just overlooked by the core team or is there a good reason to avoid LIKE here?
P.S. It looks like the static $iteration variable may be unused? PHPStorm will tell you that by coloring it gray :)
I believe that using LIKE in search queries for tags will just be too slow, in particular for bigger Elgg databases. Tags are stored in elgg_metastrings table. This table does not have a FULLTEXT key on the text column (where a tag is stored). It has an index on this column, but indexes don't help searching for substrings. To my opinion, it is a big performance issue.