hhuijser/liferay-plugins — pull request #207 by yuhai (2014-06-06 06:38:17+00:00)
Title: LPS-47459 Search portlet is taking an exceptionally long time to return ...

...results

The issue root is that the program execute unnecessary search query in Solr server so that search costs more time. Please refer to the below explanation:

In SolrFacetFieldCollector.java constructor function:
List counts = facetField.getValues();

facetField.getValues() returns all this field's values including the whole portal(count!=0 and count==0). For example, for the folderId field, it will return all folderId's value just like([11605 (2), 11628 (1), 11640 (1), 0 (0), 11652 (0), 11664 (0), 11901 (0)]).

In in html\portlet\search\facets\folders.jsp, the program will execute unnecessary search query from Solr server for these folderId("11652 (0), 11664 (0), 11901 (0)").

Fix logic: We should remove "count.getCount() == 0" data in Map _counts because these datas don't match our search situation.

Thanks,
Hai