Debugging Search Queries in Liferay

If you want to find out more information about how a search is being executed in Liferay, you can modify the logging settings to output search queries to the log. To do this, go into Control Panel-> Server Administration -> Log Levels -> Add Category and add a new entry for the class com.liferay.portal.kernel.search.SearchEngineUtil for log level DEBUG. (Please note that depending on your situation, changing the logging can dramatically impact performance, so it's probably only sensible to do this in a development environment). 

Then you can see the search queries in the Liferay log. For example, here is a search for web content related to "france" in 6.2 using Lucene: 

10:52:29,342 DEBUG [http-bio-8080-exec-19][SearchEngineUtil:663] Search query +(+((+(entryClassName:com.liferay.portlet.journal.model.JournalArticle) -(status:8)) (+(entryClassName:com.liferay.portlet.journal.model.JournalFolder) -(status:8)) (+(entryClassName:com.liferay.portlet.messageboards.model.MBMessage) -(status:8) +(discussion:true) +((-(status:8) +(classNameId:10109)) (-(status:8) +(classNameId:10013))))) +(+(groupId:10182) +(scopeGroupId:10182))) +(assetCategoryTitles:france* assetTagNames:france* comments:france content:france description:france properties:france title:france url:france userName:france* assetCategoryTitles_en_US:france* classPK:france content_en_US:france description_en_US:france entryClassPK:france title_en_US:france type:france articleId:FRANCE)

Unfortunately, information about how a search is sorted is not added to the log. But the query is very helpful for understanding how Liferay's search works!