ACE-2433: Adapt repository script to allow SOLR 4

- Changed default value of stats field to content.size for compatibility with solr4 (was contentsize, for solr 1.4)
  - Value can be updated by overriding the bean def for webscript.org.alfresco.repository.solr.stats.get

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@83721 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Will Abson
2014-09-09 15:27:40 +00:00
parent 4c640f303f
commit 17106127f0
2 changed files with 11 additions and 2 deletions

View File

@@ -1318,6 +1318,9 @@
class="org.alfresco.repo.web.scripts.solr.StatsGet" parent="webscript">
<property name="stats" ref="statsService"/>
<property name="siteService" ref="SiteService" />
<property name="statsField">
<value>content.size</value>
</property>
<property name="facets">
<map>
<entry key="content.mimetype" value="{http://www.alfresco.org/model/content/1.0}content.mimetype" />

View File

@@ -52,12 +52,18 @@ public class StatsGet extends DeclarativeWebScript
private SiteService siteService;
private Map<String,String> facets;
private Map<String,? extends StatsProcessor> postProcessors;
private String statsField;
public void setFacets(Map<String, String> facets)
{
this.facets = facets;
}
public void setStatsField(String statsField)
{
this.statsField = statsField;
}
public void setStats(StatsService stats)
{
this.stats = stats;
@@ -106,8 +112,8 @@ public class StatsGet extends DeclarativeWebScript
query = buildQuery(siteInfo, facetKey, startAndEnd);
StatsParameters params = new StatsParameters(SearchService.LANGUAGE_SOLR_FTS_ALFRESCO, query, false);
//params.addSort(new SortDefinition(SortDefinition.SortType.FIELD, "contentsize", false));
params.addStatsParameter(StatsParameters.PARAM_FIELD, "contentsize");
//params.addSort(new SortDefinition(SortDefinition.SortType.FIELD, this.statsField, false));
params.addStatsParameter(StatsParameters.PARAM_FIELD, this.statsField);
params.addStatsParameter(StatsParameters.PARAM_FACET, StatsParameters.FACET_PREFIX+propFacet.toString());
StatsResultSet result = stats.query(params);