Get User Based On Expando Value

Use below code snippet if you want to search users based on expando value. In below snippet ColumnName is the name of custom attribute (expando attribute) and data is expando value.

One more i would like to highlight here in below snippet we are looking for exact value of custom attribute . In few cases you might not have exact value of custom attribute in that case you can alter dynamic query and instead of eq you can use like query. For more information on dynamic query you check this post.

Share Services Between Plugin Portlets In Liferay

Sharing services between plugin portlets is very easy in Liferay. Usually people place services jar manually when they want to access any other portlet's services.

Here is the automated where liferay will take of the dependent service jar. You just need to name the dependent portlet's name.

Let say for your library management portlet you want to access services of student portlet. In file you need to enter below entry.

JSON Serialization in Liferay

Many times we have requirement to convert Liferay service response or any list into JSON object. Most of the time we are doing this manually.

Sort Solr Search Result

Below snippet will help you to sort solr search results.

Few things i would like to highlight about solr result sorting.
You can not sort tokenized field i mean if you have defined your solr field with the type text or textToTight.
You can sort the field which have type string . You can create dynamic fields easily in solr.
Add below entry in schema.xml and solr will automatically create field with the type string.

<dynamicField name="*_sortable" type="string" indexed="true" multiValued="false" stored="true" />

If you use any field with suffix _sortable then solr will automatically create field if it is not exist.

Sort Search Container Result

To sort search container result follow below steps.

1) Create search container in your JSP.