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:
@@ -113,6 +113,9 @@
|
||||
<property name="repositoryHelper">
|
||||
<ref bean="repositoryHelper"/>
|
||||
</property>
|
||||
<property name="solrFacetHelper">
|
||||
<ref bean="solrFacetHelper"/>
|
||||
</property>
|
||||
<property name="storeUrl">
|
||||
<value>${spaces.store}</value>
|
||||
</property>
|
||||
|
@@ -18,6 +18,7 @@
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="solrFacetConfigs" class="org.alfresco.repo.search.impl.solr.facet.SolrFacetConfig">
|
||||
<constructor-arg index="0" ref="solrFacetRawProperties" />
|
||||
<constructor-arg index="1">
|
||||
@@ -25,6 +26,7 @@
|
||||
</constructor-arg>
|
||||
<property name="namespaceService" ref="namespaceService" />
|
||||
</bean>
|
||||
|
||||
<bean id="solrFacetService" class="org.alfresco.repo.search.impl.solr.facet.SolrFacetServiceImpl">
|
||||
<property name="nodeService" ref="nodeService" />
|
||||
<property name="dictionaryService" ref="dictionaryService" />
|
||||
@@ -41,4 +43,19 @@
|
||||
<value>${solr_facets.root}</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="solrFacetHelper" class="org.alfresco.repo.search.impl.solr.facet.SolrFacetHelper">
|
||||
<constructor-arg index="0" ref="ServiceRegistry" />
|
||||
<property name="specialFacetIds">
|
||||
<set>
|
||||
<value>SITE</value>
|
||||
<value>TAG</value>
|
||||
<value>ANCESTOR</value>
|
||||
<value>PARENT</value>
|
||||
<value>ASPECT</value>
|
||||
<value>TYPE</value>
|
||||
<value>OWNER</value>
|
||||
</set>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
@@ -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)
|
||||
|
@@ -106,6 +106,16 @@ public class SolrFacetHelper
|
||||
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;
|
||||
|
||||
@@ -289,6 +299,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