On 12/26/2011 12:40 AM, mohit gupta wrote:
I have configured to use Lucene search in my xwiki application. Right now
  in xwiki ,  any  user is able to search any other user details  by
entering his deatils in serach text box.I want to configure it in a way
user should be  able to  search the other users who belongs to same group
otherwise it should not other group user details. Is it configurable in
xwiki or i need to make some changes in code for the same.Thanks.

Search results should only display what is normally visible by the current user. So, even though you might succeed in making Lucene not return these users in a query, the user profiles are still visible to the user.

Another point, all users should normally be in at least one common group, XWiki.XWikiAllGroup, unless you explicitly disable this feature.

Still, to answer your question, it should be possible to configure the search results so that it displays only users having a group in common, but it's not very easy. One problem is that groups are defined in a group document, while Lucene only considers one document at a time, so whenever it's considering whether or not to include a user document in the results, it doesn't have access to the group definition, so you'll have to somehow use this information some other way. One option is to change the indexing process so that each Lucene document corresponding to a user should also list all the groups that user belongs to. Another option is to post-filter the results returned by Lucene so that you remove all the user profiles that shouldn't be returned.
Sergiu Dumitriu
users mailing list

Reply via email to