mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
13700: ETHREEOH-1724 - Site finder does not search site names git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13708 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -572,8 +572,8 @@ public class SiteServiceImpl implements SiteService, SiteModel
|
|||||||
NodeRef siteRoot = getSiteRoot();
|
NodeRef siteRoot = getSiteRoot();
|
||||||
if (nameFilter != null && nameFilter.length() != 0)
|
if (nameFilter != null && nameFilter.length() != 0)
|
||||||
{
|
{
|
||||||
// Perform a Lucene search under the Site parent node using *name* search query
|
// Perform a Lucene search under the Site parent node using *name*, *title* and *description* search query
|
||||||
QueryParameterDefinition[] params = new QueryParameterDefinition[1];
|
QueryParameterDefinition[] params = new QueryParameterDefinition[3];
|
||||||
params[0] = new QueryParameterDefImpl(
|
params[0] = new QueryParameterDefImpl(
|
||||||
ContentModel.PROP_NAME,
|
ContentModel.PROP_NAME,
|
||||||
dictionaryService.getDataType(
|
dictionaryService.getDataType(
|
||||||
@@ -581,10 +581,26 @@ public class SiteServiceImpl implements SiteService, SiteModel
|
|||||||
true,
|
true,
|
||||||
LuceneQueryParser.escape(nameFilter.replace('"', ' ')));
|
LuceneQueryParser.escape(nameFilter.replace('"', ' ')));
|
||||||
|
|
||||||
|
params[1] = new QueryParameterDefImpl(
|
||||||
|
ContentModel.PROP_TITLE,
|
||||||
|
dictionaryService.getDataType(
|
||||||
|
DataTypeDefinition.TEXT),
|
||||||
|
true,
|
||||||
|
QueryParser.escape(nameFilter.replace('"', ' ')));
|
||||||
|
|
||||||
|
params[2] = new QueryParameterDefImpl(
|
||||||
|
ContentModel.PROP_DESCRIPTION,
|
||||||
|
dictionaryService.getDataType(
|
||||||
|
DataTypeDefinition.TEXT),
|
||||||
|
true,
|
||||||
|
QueryParser.escape(nameFilter.replace('"', ' ')));
|
||||||
|
|
||||||
// get the sites that match the specified names
|
// get the sites that match the specified names
|
||||||
StringBuilder query = new StringBuilder(128);
|
StringBuilder query = new StringBuilder(128);
|
||||||
query.append("+PARENT:\"").append(siteRoot.toString())
|
query.append("+PARENT:\"").append(siteRoot.toString())
|
||||||
.append("\" +@cm\\:name:\"*${cm:name}*\"");
|
.append("\" +(@cm\\:name:\"*${cm:name}*\"")
|
||||||
|
.append(" @cm\\:title:\"*${cm:title}*\"")
|
||||||
|
.append(" @cm\\:description:\"*${cm:description}*\")");
|
||||||
ResultSet results = this.searchService.query(
|
ResultSet results = this.searchService.query(
|
||||||
siteRoot.getStoreRef(),
|
siteRoot.getStoreRef(),
|
||||||
SearchService.LANGUAGE_LUCENE,
|
SearchService.LANGUAGE_LUCENE,
|
||||||
|
@@ -237,6 +237,22 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
sites = this.siteService.listSites(null, null);
|
sites = this.siteService.listSites(null, null);
|
||||||
assertNotNull(sites);
|
assertNotNull(sites);
|
||||||
assertEquals(4, sites.size());
|
assertEquals(4, sites.size());
|
||||||
|
|
||||||
|
// Get sites by matching name
|
||||||
|
sites = this.siteService.listSites("One", null);
|
||||||
|
assertNotNull(sites);
|
||||||
|
assertEquals(1, sites.size());
|
||||||
|
|
||||||
|
// Get sites by matching title
|
||||||
|
sites = this.siteService.listSites("title", null);
|
||||||
|
assertNotNull(sites);
|
||||||
|
assertEquals(4, sites.size());
|
||||||
|
|
||||||
|
// Get sites by matching description
|
||||||
|
sites = this.siteService.listSites("description", null);
|
||||||
|
assertNotNull(sites);
|
||||||
|
assertEquals(4, sites.size());
|
||||||
|
|
||||||
// Do detailed check of the site info objects
|
// Do detailed check of the site info objects
|
||||||
for (SiteInfo site : sites)
|
for (SiteInfo site : sites)
|
||||||
{
|
{
|
||||||
|
@@ -483,6 +483,18 @@ public abstract class BaseContentNode implements TemplateContent
|
|||||||
return (o instanceof TemplateContentData);
|
return (o instanceof TemplateContentData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to return true if the supplied property value is a TemplateNodeRef object
|
||||||
|
*
|
||||||
|
* @param o Object to test
|
||||||
|
*
|
||||||
|
* @return true if instanceof isTemplateNodeRef, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isTemplateNodeRef(Object o)
|
||||||
|
{
|
||||||
|
return (o instanceof TemplateNodeRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Inner classes
|
// Inner classes
|
||||||
|
Reference in New Issue
Block a user