mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Refactor of the SiteService Lucene query to support users explicitly searching for "*" in the site-finder UI.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29015 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -750,13 +750,17 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
|
||||
StringBuilder query = new StringBuilder(128);
|
||||
query.append("+PARENT:\"").append(siteRoot.toString()).append('"');
|
||||
|
||||
final boolean nameFilterIsPresent = filter != null && filter.length() > 0;
|
||||
final boolean filterIsPresent = filter != null && filter.length() > 0;
|
||||
// The filter string is only used in the Lucene query if it restricts results.
|
||||
// A search for name/title/description = "*" does not need to be put into the Lucene query.
|
||||
// This allows users to search for "*" in the site-finder.
|
||||
final boolean filterIsPresentAndNecessary = filterIsPresent && !filter.equals("*");
|
||||
final boolean sitePresetFilterIsPresent = sitePresetFilter != null && sitePresetFilter.length() > 0;
|
||||
|
||||
if (nameFilterIsPresent || sitePresetFilterIsPresent)
|
||||
if (filterIsPresentAndNecessary || sitePresetFilterIsPresent)
|
||||
{
|
||||
query.append(" +(");
|
||||
if (nameFilterIsPresent)
|
||||
if (filterIsPresentAndNecessary)
|
||||
{
|
||||
String escNameFilter = AbstractLuceneQueryParser.escape(filter.replace('"', ' '));
|
||||
|
||||
|
Reference in New Issue
Block a user