Foros de discusión

Liferay 6.2 Customize Search Users

thumbnail
vy the bui, modificado hace 6 años.

Liferay 6.2 Customize Search Users

New Member Mensajes: 12 Fecha de incorporación: 7/12/15 Mensajes recientes
Hello everybody,

I have a question related to Liferay 6.2 existing Search feature.

We have certain people in our system, that we do not want them to be included in any search result. Is it possible to add a marker on the person that will indicate they are to be excluded from any Search result?

Archivos adjuntos:

thumbnail
Eduardo P. García, modificado hace 3 años.

RE: Liferay 6.2 Customize Search Users

Regular Member Mensajes: 157 Fecha de incorporación: 16/03/12 Mensajes recientes
Hi ,

You can add a boolean custom field to the user (like "exclude from search results"), customize the User Indexer Post Processor to index it and later exclude those users from the results. See this documentation for more details.

Regards
thumbnail
vy the bui, modificado hace 6 años.

RE: Liferay 6.2 Customize Search Users

New Member Mensajes: 12 Fecha de incorporación: 7/12/15 Mensajes recientes
Hi Eduardo,

Thank you very much for your response. I've been stuck on this issue for a week.

One thing I do not get is in the document, they are trying to "extend" attributes of a user in the Search feature. While I am trying to exclude the user in the search result.

From what I understand the flow of adding/editing a user would be like this:
Add/Edit a User -> Index -> Result.

What I am doing right now is: Add/Edit a User -> Index (exclude if a user cannot be searched) -> Results.

I think your solution is the very good idea. It is like this: Add/Edit a User -> Index -> Result (exclude if a user cannot be searched). The problem is I do not know where I could exclude the result. Could you tell me a little about where I can exclude those users from the results? Is it in "postProcessSearchQuery()".

And if it is right can I do like this in postProcessSearchQuery:

usersGroupsQuery.addTerm("userGroupIds", userGroupId);
usersGroupsQuery.add(usersGroupsQuery, BooleanClauseOccur.MUST_NOT);

userGroupId is the Identify of group where the unsearchable users are in.

I am looking forward to hearing you!

Regards,