Forums | Mahara Community

Developers /
Search Modification

Stephen C's profile picture
Posts: 117

10 May 2009, 8:58 PM

Before I start modifying big chunks of the search functions, I don't suppose anybody has already modified the search functionality and would be willing to share their code?

I need to add functionality to allow users to search the data in a specific artefact, instead of all. For example, search for users with "art" in their interests.

I also need the ability to allow users to sort the results in the manner that they want (name ascending, name descending, last active, etc.).

Ultimately, I'm going to make certain data on the profile and resume hyperlinks for quick searches.

Looking at the code, it doesn't seem like it is going to be too difficult to accomplish these things, but if somebody has some already modified code that accomplishes at least one of these things that they'd be willing to share, it would be greatly appreciated.  Any tips would be helpful as well.


Nigel's profile picture
Posts: 1643

11 May 2009, 7:52 PM

Hi - we haven't done anything around search ourselves since the original funding, but I can give some general tips.

There are options in the admin section for making certain profile fields public. Unfortunately, Mahara doesn't tell users about which of their fields are public or not, which is a shame, but any field can be made 'public', and thus searchable on, by checking a box.

The disadvantage of this is that the search results are not ordered by relevance and don't show all fields, so it's hard to see why someone matched.

You'd probably want to ignore this particular functionality for the improvements you're doing, but I would suggest indicating to people that you're making their profile information searchable - and possibly even provide them with ways to turn that off. Many people like their  privacy.

From a code point of view, I encourage you to investigate searchlib.php and the search/ directory. They'll give you clues as to how the searching works, and if you can integrate your stuff with that system, then it will probably be in  a much more robust state.

Finally - this work sounds quite interesting, and could be useful for the upstream Mahara project. We'd definitely want to see privacy controls included as well, I think, but even if you don't bother with those we could still be keen on merging your work upstream - if that's OK with you!

Stephen C's profile picture
Posts: 117

11 May 2009, 10:17 PM

Thanks for the tips. Yes, only certain profile fields will be searchable and it will be somewhat obvious to the users which ones are and aren't. 

For the most part, we have found that people would prefer the search functionality to be very similar to the way the popular social networking sites (Facebook, MySpace, etc.) handle searches. Users are usually already comfortable and familiar with those sites, so implementing similar search features would greatly reduce the learning curve when using the Mahara powered site. The most obvious example would be making each comma separated bit of text in the interests field a hyperlink that leads to search results of other users with the same interest.

I'll probably add the option to make a profile viewable only by friends and the ability to remove yourself from being searched.  Additionally, I'll probably add the ability to search for people using email addresses (it will only match exact email address matches).

So, lots of work ahead of me, but I'm loving Mahara. I'll be sure to share what I can with other users. I have plans for several plugins, but I'm still working on figuring out all the ins and outs of Mahara first.

Nigel's profile picture
Posts: 1643

12 May 2009, 7:14 PM

Great stuff - keep us posted! Cool We can help out with any specific questions you have, of course. You might find it useful to join #mahara on freenode to get real-time help if you need it too.
4 results