Hey guys,
I would like to have a functionality which woudl enable me to search for other users based on certain profile fields such as "Univeristy Degree", "Gender", "Interests" for a univeristy social media site. I have been looking around and haven't been able to find anything. I've found out that it existed in previous versions of profile manager, but is no longer supported.
Can someone point me in the right direction please? Im not a very experienced coder, but when push comes to shove, I can manage with non-complex mysql/php/html scripts.
Thanks guys, Appreciate it
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.
Check out this fix for adding profile fields to searches: https://github.com/sembrestels/Elgg/commit/ff0c20bf6d81b74678e31a3e8dfd101d9a76d633#L0L151
I'm not a programmer, but I was able to make this change to the search plugin pretty easily and it works great on Elgg 1.8.6!
You can also make this edit to start.php in the search plugin to allow for partial match returns:
$where = "(MATCH ($fields_str) AGAINST ('$query*' $options))";
The difference is the * added after $query. In my plugin it is line 445, but it looks like it is line 447 in the latest release. I can't find the post that suggested this edit but it somewhere here in the forum.
One thing to mention here is that allowing partial matches is going to generate a lot more matches and may slow down your searches on large sites.
good tips ;-P
database accesses will generally not quite slow down site ~ it's usually the server's responses (@performance) that causes issues.
Ed and Dhrup, thanks for your advice! Ed, can did you use profile manager to create additional searchable fields?
Thanks!
Yep. However, I haven't had much time to dig into the specifics yet. For example, I haven't yet figured out why some matches return just a user name and others return user names with the matching text.
Hi Ed, I've tried implementing your suggestion of adding * to the search and I'm not sure if i'm 100% understanding your idea.
So lets say an existing search of "Commerce" would return a list of results.
But with partial match returns, when i search for "Commerce Engineering", results should include everyone who does Commerce and/or Engineering, right?
Unfortunately it still seems to return a null result when i search for an existing content + non-existant key words. If the above is how partial match is meant to work, it would be quite strange as i've already added the * to line 447!
Thanks!
Sorry, I don't know the mechanics behind these modifications. I just passed along some tips that I found. Hopefully, someone who knows will chime in.
I am not sure why you aren't able to search on profile fields. I think this support was added in 1.8.12.
What issues are you facing? I am able to search on profile fields, using 1.8.12 and 7.4.1 and I don't see anything in 7.5.1 stopping you from searching it. Elgg's design is not optimized for searching, I believe this will need to be addressed pretty soon since search is a very important feature in any social platform.
FYI. I think that the fix I posted above is what was implemented in 1.8.12 and is backwards compatible with those of us using older 1.8 versions of Elgg (I know it's compatible with 1.8.6).
Sorry, I still don't have an answer for why it returns a null result when searching for existing content + non-existant key words. Perhaps it is because the * only returns strings that include the entire search phrase as part of a longer text string? In other words, you would need to conduct a separate search for each of the Commerce AND Engineering results.
Hi Ed.
You say these changes were implemented in 1.8.12, but I see no advanced search.
Can you speficy exactly what changes you made?
Ta
Mat
- Previous
- 1
- 2
- Next
You must log in to post replies.