mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Additional handling for "special" facet IDs (SITE, TAG etc). Part of ACE-2639.
This check-in ensures that those facet IDs are not prefixed with the '@' char like all other facet IDs. The list is currently injected from solr-facets-context.xml, which required a slight refactoring of spring beans to make SolrFacetHelper a bean. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85711 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -104,6 +104,12 @@ public class Search extends BaseScopableProcessorExtension implements Initializi
|
||||
|
||||
this.solrFacetHelper = new SolrFacetHelper(services);
|
||||
}
|
||||
|
||||
public void setSolrFacetHelper(SolrFacetHelper solrFacetHelper)
|
||||
{
|
||||
this.solrFacetHelper = solrFacetHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default store reference
|
||||
*
|
||||
@@ -717,8 +723,18 @@ public class Search extends BaseScopableProcessorExtension implements Initializi
|
||||
{
|
||||
for (String field: facets)
|
||||
{
|
||||
sp.addFieldFacet(new FieldFacet("@" + field));
|
||||
final FieldFacet fieldFacet;
|
||||
if (solrFacetHelper.isSpecialFacetId(field))
|
||||
{
|
||||
fieldFacet = new FieldFacet(field);
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldFacet = new FieldFacet("@" + field);
|
||||
}
|
||||
sp.addFieldFacet(fieldFacet);
|
||||
}
|
||||
|
||||
List<String> facetQueries = null;
|
||||
// Workaround for ACE-1605
|
||||
if (query.indexOf("created:") < 0 && query.indexOf("modified:") < 0)
|
||||
|
@@ -105,7 +105,17 @@ public class SolrFacetHelper
|
||||
BUCKETED_FIELD_FACETS.add(MODIFIED_FIELD_FACET_QUERY);
|
||||
BUCKETED_FIELD_FACETS.add(CONTENT_SIZE_FIELD_FACET_QUERY);
|
||||
}
|
||||
|
||||
|
||||
/** These facet IDs are recognised by SOLR and can be used directly within facetted searches. */
|
||||
private Set<String> specialFacetIds = Collections.emptySet();
|
||||
{
|
||||
}
|
||||
|
||||
public void setSpecialFacetIds(Set<String> ids)
|
||||
{
|
||||
this.specialFacetIds = ids;
|
||||
}
|
||||
|
||||
/** Facet value and facet query display label handlers */
|
||||
private Map<String, FacetLabelDisplayHandler> displayHandlers;
|
||||
|
||||
@@ -288,6 +298,15 @@ public class SolrFacetHelper
|
||||
{
|
||||
return Collections.unmodifiableSet(BUCKETED_FIELD_FACETS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the specified facet ID part of the list of "specials" which are
|
||||
* handled by our SOLR service as is?
|
||||
*/
|
||||
public boolean isSpecialFacetId(String facetId)
|
||||
{
|
||||
return specialFacetIds.contains(facetId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Date buckets. The dates are in ISO8601 format (yyyy-MM-dd)
|
||||
|
Reference in New Issue
Block a user