mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
80509: Merged WAT1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 74144: ACE-1582: added: - more facet props to the Model and the related JSON response - GET one facet API - Sorting by facet index git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82806 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -46,6 +46,16 @@
|
|||||||
<tokenised>false</tokenised>
|
<tokenised>false</tokenised>
|
||||||
</index>
|
</index>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="srft:displayControl">
|
||||||
|
<title>Field Display Control</title>
|
||||||
|
<type>d:text</type>
|
||||||
|
<mandatory>true</mandatory>
|
||||||
|
<index enabled="false">
|
||||||
|
<atomic>false</atomic>
|
||||||
|
<stored>false</stored>
|
||||||
|
<tokenised>false</tokenised>
|
||||||
|
</index>
|
||||||
|
</property>
|
||||||
<property name="srft:maxFilters">
|
<property name="srft:maxFilters">
|
||||||
<title>Maximum Filters</title>
|
<title>Maximum Filters</title>
|
||||||
<type>d:int</type>
|
<type>d:int</type>
|
||||||
@@ -127,6 +137,16 @@
|
|||||||
<tokenised>false</tokenised>
|
<tokenised>false</tokenised>
|
||||||
</index>
|
</index>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="srft:isDefault">
|
||||||
|
<title>Is Default (loaded from a properties file)</title>
|
||||||
|
<type>d:boolean</type>
|
||||||
|
<mandatory>true</mandatory>
|
||||||
|
<index enabled="false">
|
||||||
|
<atomic>false</atomic>
|
||||||
|
<stored>false</stored>
|
||||||
|
<tokenised>false</tokenised>
|
||||||
|
</index>
|
||||||
|
</property>
|
||||||
</properties>
|
</properties>
|
||||||
</type>
|
</type>
|
||||||
<!-- Facets Root Folder -->
|
<!-- Facets Root Folder -->
|
||||||
@@ -135,4 +155,4 @@
|
|||||||
<parent>cm:folder</parent>
|
<parent>cm:folder</parent>
|
||||||
</type>
|
</type>
|
||||||
</types>
|
</types>
|
||||||
</model>
|
</model>
|
@@ -6,6 +6,7 @@
|
|||||||
# Field-Facet-Qname => cm:content.mimetype
|
# Field-Facet-Qname => cm:content.mimetype
|
||||||
default.cm\:content.mimetype.filterID=filter_mimetype
|
default.cm\:content.mimetype.filterID=filter_mimetype
|
||||||
default.cm\:content.mimetype.displayName=faceted-search.facet-menu.facet.formats
|
default.cm\:content.mimetype.displayName=faceted-search.facet-menu.facet.formats
|
||||||
|
default.cm\:content.mimetype.displayControl=alfresco/search/FacetFilters
|
||||||
default.cm\:content.mimetype.maxFilters=5
|
default.cm\:content.mimetype.maxFilters=5
|
||||||
default.cm\:content.mimetype.hitThreshold=1
|
default.cm\:content.mimetype.hitThreshold=1
|
||||||
default.cm\:content.mimetype.minFilterValueLength=4
|
default.cm\:content.mimetype.minFilterValueLength=4
|
||||||
@@ -18,6 +19,7 @@ default.cm\:content.mimetype.isEnabled=true
|
|||||||
# Field-Facet-Qname => cm:description.__
|
# Field-Facet-Qname => cm:description.__
|
||||||
default.cm\:description.__.filterID=filter_description
|
default.cm\:description.__.filterID=filter_description
|
||||||
default.cm\:description.__.displayName=faceted-search.facet-menu.facet.description
|
default.cm\:description.__.displayName=faceted-search.facet-menu.facet.description
|
||||||
|
default.cm\:description.__.displayControl=alfresco/search/FacetFilters
|
||||||
default.cm\:description.__.maxFilters=5
|
default.cm\:description.__.maxFilters=5
|
||||||
default.cm\:description.__.hitThreshold=1
|
default.cm\:description.__.hitThreshold=1
|
||||||
default.cm\:description.__.minFilterValueLength=4
|
default.cm\:description.__.minFilterValueLength=4
|
||||||
@@ -30,6 +32,7 @@ default.cm\:description.__.isEnabled=true
|
|||||||
# Field-Facet-Qname => cm:creator.__.u
|
# Field-Facet-Qname => cm:creator.__.u
|
||||||
default.cm\:creator.__.u.filterID=filter_creator
|
default.cm\:creator.__.u.filterID=filter_creator
|
||||||
default.cm\:creator.__.u.displayName=faceted-search.facet-menu.facet.creator
|
default.cm\:creator.__.u.displayName=faceted-search.facet-menu.facet.creator
|
||||||
|
default.cm\:creator.__.u.displayControl=alfresco/search/FacetFilters
|
||||||
default.cm\:creator.__.u.maxFilters=5
|
default.cm\:creator.__.u.maxFilters=5
|
||||||
default.cm\:creator.__.u.hitThreshold=1
|
default.cm\:creator.__.u.hitThreshold=1
|
||||||
default.cm\:creator.__.u.minFilterValueLength=4
|
default.cm\:creator.__.u.minFilterValueLength=4
|
||||||
@@ -42,6 +45,7 @@ default.cm\:creator.__.u.isEnabled=true
|
|||||||
# Field-Facet-Qname => cm:modifier.__.u
|
# Field-Facet-Qname => cm:modifier.__.u
|
||||||
default.cm\:modifier.__.u.filterID=filter_modifier
|
default.cm\:modifier.__.u.filterID=filter_modifier
|
||||||
default.cm\:modifier.__.u.displayName=faceted-search.facet-menu.facet.modifier
|
default.cm\:modifier.__.u.displayName=faceted-search.facet-menu.facet.modifier
|
||||||
|
default.cm\:modifier.__.u.displayControl=alfresco/search/FacetFilters
|
||||||
default.cm\:modifier.__.u.maxFilters=5
|
default.cm\:modifier.__.u.maxFilters=5
|
||||||
default.cm\:modifier.__.u.hitThreshold=1
|
default.cm\:modifier.__.u.hitThreshold=1
|
||||||
default.cm\:modifier.__.u.minFilterValueLength=4
|
default.cm\:modifier.__.u.minFilterValueLength=4
|
||||||
@@ -54,6 +58,7 @@ default.cm\:modifier.__.u.isEnabled=true
|
|||||||
# Field-Facet-Qname => cm:created
|
# Field-Facet-Qname => cm:created
|
||||||
default.cm\:created.filterID=filter_created
|
default.cm\:created.filterID=filter_created
|
||||||
default.cm\:created.displayName=faceted-search.facet-menu.facet.created
|
default.cm\:created.displayName=faceted-search.facet-menu.facet.created
|
||||||
|
default.cm\:created.displayControl=alfresco/search/FacetFilters
|
||||||
default.cm\:created.blockIncludeFacetRequest=true
|
default.cm\:created.blockIncludeFacetRequest=true
|
||||||
default.cm\:created.maxFilters=5
|
default.cm\:created.maxFilters=5
|
||||||
default.cm\:created.hitThreshold=1
|
default.cm\:created.hitThreshold=1
|
||||||
@@ -67,6 +72,7 @@ default.cm\:created.isEnabled=true
|
|||||||
# Field-Facet-Qname => cm:modified
|
# Field-Facet-Qname => cm:modified
|
||||||
default.cm\:modified.filterID=filter_modified
|
default.cm\:modified.filterID=filter_modified
|
||||||
default.cm\:modified.displayName=faceted-search.facet-menu.facet.modified
|
default.cm\:modified.displayName=faceted-search.facet-menu.facet.modified
|
||||||
|
default.cm\:modified.displayControl=alfresco/search/FacetFilters
|
||||||
default.cm\:modified.blockIncludeFacetRequest=true
|
default.cm\:modified.blockIncludeFacetRequest=true
|
||||||
default.cm\:modified.maxFilters=5
|
default.cm\:modified.maxFilters=5
|
||||||
default.cm\:modified.hitThreshold=1
|
default.cm\:modified.hitThreshold=1
|
||||||
@@ -80,6 +86,7 @@ default.cm\:modified.isEnabled=true
|
|||||||
# Field-Facet-Qname => cm:content.size
|
# Field-Facet-Qname => cm:content.size
|
||||||
default.cm\:content.size.filterID=filter_content_size
|
default.cm\:content.size.filterID=filter_content_size
|
||||||
default.cm\:content.size.displayName=faceted-search.facet-menu.facet.size
|
default.cm\:content.size.displayName=faceted-search.facet-menu.facet.size
|
||||||
|
default.cm\:content.size.displayControl=alfresco/search/FacetFilters
|
||||||
default.cm\:content.size.blockIncludeFacetRequest=true
|
default.cm\:content.size.blockIncludeFacetRequest=true
|
||||||
default.cm\:content.size.maxFilters=5
|
default.cm\:content.size.maxFilters=5
|
||||||
default.cm\:content.size.hitThreshold=1
|
default.cm\:content.size.hitThreshold=1
|
||||||
|
@@ -178,6 +178,7 @@ public class SolrFacetConfig extends AbstractLifecycleBean
|
|||||||
QName fieldQName = resolveToQName(namespaceService, field);
|
QName fieldQName = resolveToQName(namespaceService, field);
|
||||||
String filterID = propValues.get(ValueName.PROP_FILTER_ID.getPropValueName(field));
|
String filterID = propValues.get(ValueName.PROP_FILTER_ID.getPropValueName(field));
|
||||||
String displayName = propValues.get(ValueName.PROP_DISPLAY_NAME.getPropValueName(field));
|
String displayName = propValues.get(ValueName.PROP_DISPLAY_NAME.getPropValueName(field));
|
||||||
|
String displayControl = propValues.get(ValueName.PROP_DISPLAY_CONTROL.getPropValueName(field));
|
||||||
int maxFilters = getIntegerValue(propValues.get(ValueName.PROP_MAX_FILTERS.getPropValueName(field)));
|
int maxFilters = getIntegerValue(propValues.get(ValueName.PROP_MAX_FILTERS.getPropValueName(field)));
|
||||||
int hitThreshold = getIntegerValue(propValues.get(ValueName.PROP_HIT_THRESHOLD.getPropValueName(field)));
|
int hitThreshold = getIntegerValue(propValues.get(ValueName.PROP_HIT_THRESHOLD.getPropValueName(field)));
|
||||||
int minFilterValueLength = getIntegerValue(propValues.get(ValueName.PROP_MIN_FILTER_VALUE_LENGTH.getPropValueName(field)));
|
int minFilterValueLength = getIntegerValue(propValues.get(ValueName.PROP_MIN_FILTER_VALUE_LENGTH.getPropValueName(field)));
|
||||||
@@ -192,6 +193,7 @@ public class SolrFacetConfig extends AbstractLifecycleBean
|
|||||||
.filterID(filterID)
|
.filterID(filterID)
|
||||||
.facetQName(fieldQName)
|
.facetQName(fieldQName)
|
||||||
.displayName(displayName)
|
.displayName(displayName)
|
||||||
|
.displayControl(displayControl)
|
||||||
.maxFilters(maxFilters)
|
.maxFilters(maxFilters)
|
||||||
.hitThreshold(hitThreshold)
|
.hitThreshold(hitThreshold)
|
||||||
.minFilterValueLength(minFilterValueLength)
|
.minFilterValueLength(minFilterValueLength)
|
||||||
@@ -199,6 +201,7 @@ public class SolrFacetConfig extends AbstractLifecycleBean
|
|||||||
.scope(scope)
|
.scope(scope)
|
||||||
.index(index)
|
.index(index)
|
||||||
.isEnabled(isEnabled)
|
.isEnabled(isEnabled)
|
||||||
|
.isDefault(true)
|
||||||
.scopedSites(scopedSites).build();
|
.scopedSites(scopedSites).build();
|
||||||
|
|
||||||
facetProperties.put(filterID, fp);
|
facetProperties.put(filterID, fp);
|
||||||
@@ -309,7 +312,7 @@ public class SolrFacetConfig extends AbstractLifecycleBean
|
|||||||
{
|
{
|
||||||
PROP_FILTER_ID("filterID"), PROP_DISPLAY_NAME("displayName"), PROP_MAX_FILTERS("maxFilters"), PROP_HIT_THRESHOLD("hitThreshold"),
|
PROP_FILTER_ID("filterID"), PROP_DISPLAY_NAME("displayName"), PROP_MAX_FILTERS("maxFilters"), PROP_HIT_THRESHOLD("hitThreshold"),
|
||||||
PROP_MIN_FILTER_VALUE_LENGTH("minFilterValueLength"), PROP_SORTBY("sortBy"), PROP_SCOPE("scope"), PROP_SCOPED_SITES("scopedSites"),
|
PROP_MIN_FILTER_VALUE_LENGTH("minFilterValueLength"), PROP_SORTBY("sortBy"), PROP_SCOPE("scope"), PROP_SCOPED_SITES("scopedSites"),
|
||||||
PROP_INDEX("index"), PROP_IS_ENABLED("isEnabled");
|
PROP_INDEX("index"), PROP_IS_ENABLED("isEnabled"), PROP_DISPLAY_CONTROL("displayControl");
|
||||||
|
|
||||||
private ValueName(String propValueName)
|
private ValueName(String propValueName)
|
||||||
{
|
{
|
||||||
|
@@ -37,6 +37,8 @@ public interface SolrFacetModel
|
|||||||
|
|
||||||
public static final QName PROP_FIELD_LABEL = QName.createQName(SOLR_FACET_MODEL_URL, "fieldLabel");
|
public static final QName PROP_FIELD_LABEL = QName.createQName(SOLR_FACET_MODEL_URL, "fieldLabel");
|
||||||
|
|
||||||
|
public static final QName PROP_DISPLAY_CONTROL = QName.createQName(SOLR_FACET_MODEL_URL, "displayControl");
|
||||||
|
|
||||||
public static final QName PROP_MAX_FILTERS = QName.createQName(SOLR_FACET_MODEL_URL, "maxFilters");
|
public static final QName PROP_MAX_FILTERS = QName.createQName(SOLR_FACET_MODEL_URL, "maxFilters");
|
||||||
|
|
||||||
public static final QName PROP_HIT_THRESHOLD = QName.createQName(SOLR_FACET_MODEL_URL, "hitThreshold");
|
public static final QName PROP_HIT_THRESHOLD = QName.createQName(SOLR_FACET_MODEL_URL, "hitThreshold");
|
||||||
@@ -52,4 +54,6 @@ public interface SolrFacetModel
|
|||||||
public static final QName PROP_INDEX = QName.createQName(SOLR_FACET_MODEL_URL, "index");
|
public static final QName PROP_INDEX = QName.createQName(SOLR_FACET_MODEL_URL, "index");
|
||||||
|
|
||||||
public static final QName PROP_IS_ENABLED = QName.createQName(SOLR_FACET_MODEL_URL, "isEnabled");
|
public static final QName PROP_IS_ENABLED = QName.createQName(SOLR_FACET_MODEL_URL, "isEnabled");
|
||||||
|
|
||||||
|
public static final QName PROP_IS_DEFAULT = QName.createQName(SOLR_FACET_MODEL_URL, "isDefault");
|
||||||
}
|
}
|
||||||
|
@@ -31,11 +31,12 @@ import org.alfresco.service.namespace.QName;
|
|||||||
*
|
*
|
||||||
* @author Jamal Kaabi-Mofrad
|
* @author Jamal Kaabi-Mofrad
|
||||||
*/
|
*/
|
||||||
public class SolrFacetProperties
|
public class SolrFacetProperties implements Comparable<SolrFacetProperties>
|
||||||
{
|
{
|
||||||
private final String filterID;
|
private final String filterID;
|
||||||
private final QName facetQName;
|
private final QName facetQName;
|
||||||
private final String displayName;
|
private final String displayName;
|
||||||
|
private final String displayControl;
|
||||||
private final int maxFilters;
|
private final int maxFilters;
|
||||||
private final int hitThreshold;
|
private final int hitThreshold;
|
||||||
private final int minFilterValueLength;
|
private final int minFilterValueLength;
|
||||||
@@ -44,6 +45,7 @@ public class SolrFacetProperties
|
|||||||
private final Set<String> scopedSites;
|
private final Set<String> scopedSites;
|
||||||
private final int index;
|
private final int index;
|
||||||
private final boolean isEnabled;
|
private final boolean isEnabled;
|
||||||
|
private final boolean isDefault; // is loaded from properties files?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises a newly created <code>SolrFacetProperty</code> object
|
* Initialises a newly created <code>SolrFacetProperty</code> object
|
||||||
@@ -55,6 +57,7 @@ public class SolrFacetProperties
|
|||||||
this.filterID = builder.filterID;
|
this.filterID = builder.filterID;
|
||||||
this.facetQName = builder.facetQName;
|
this.facetQName = builder.facetQName;
|
||||||
this.displayName = builder.displayName;
|
this.displayName = builder.displayName;
|
||||||
|
this.displayControl = builder.displayControl;
|
||||||
this.maxFilters = builder.maxFilters;
|
this.maxFilters = builder.maxFilters;
|
||||||
this.hitThreshold = builder.hitThreshold;
|
this.hitThreshold = builder.hitThreshold;
|
||||||
this.minFilterValueLength = builder.minFilterValueLength;
|
this.minFilterValueLength = builder.minFilterValueLength;
|
||||||
@@ -62,6 +65,7 @@ public class SolrFacetProperties
|
|||||||
this.scope = builder.scope;
|
this.scope = builder.scope;
|
||||||
this.index = builder.index;
|
this.index = builder.index;
|
||||||
this.isEnabled = builder.isEnabled;
|
this.isEnabled = builder.isEnabled;
|
||||||
|
this.isDefault = builder.isDefault;
|
||||||
this.scopedSites = (builder.scopedSites == null) ? null :Collections.unmodifiableSet(new HashSet<String>(builder.scopedSites));
|
this.scopedSites = (builder.scopedSites == null) ? null :Collections.unmodifiableSet(new HashSet<String>(builder.scopedSites));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,6 +93,14 @@ public class SolrFacetProperties
|
|||||||
return this.displayName;
|
return this.displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the displayControl
|
||||||
|
*/
|
||||||
|
public String getDisplayControl()
|
||||||
|
{
|
||||||
|
return this.displayControl;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the maxFilters
|
* @return the maxFilters
|
||||||
*/
|
*/
|
||||||
@@ -159,6 +171,16 @@ public class SolrFacetProperties
|
|||||||
return this.isEnabled;
|
return this.isEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the facet is a default facet (loaded from a configuration file) or not
|
||||||
|
*
|
||||||
|
* @return true if the facet is default, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isDefault()
|
||||||
|
{
|
||||||
|
return this.isDefault;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see java.lang.Object#hashCode()
|
* @see java.lang.Object#hashCode()
|
||||||
*/
|
*/
|
||||||
@@ -204,21 +226,31 @@ public class SolrFacetProperties
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see java.lang.Comparable#compareTo(T)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int compareTo(SolrFacetProperties that)
|
||||||
|
{
|
||||||
|
return Integer.compare(this.index, that.index);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuilder builder2 = new StringBuilder(270);
|
StringBuilder sb = new StringBuilder(320);
|
||||||
builder2.append("FacetProperty [filterID=").append(this.filterID).append(", facetQName=")
|
sb.append("FacetProperty [filterID=").append(this.filterID).append(", facetQName=")
|
||||||
.append(this.facetQName).append(", displayName=").append(this.displayName).append(", maxFilters=")
|
.append(this.facetQName).append(", displayName=").append(this.displayName)
|
||||||
|
.append(", displayControl=").append(this.displayControl).append(", maxFilters=")
|
||||||
.append(this.maxFilters).append(", hitThreshold=").append(this.hitThreshold)
|
.append(this.maxFilters).append(", hitThreshold=").append(this.hitThreshold)
|
||||||
.append(", minFilterValueLength=").append(this.minFilterValueLength).append(", sortBy=")
|
.append(", minFilterValueLength=").append(this.minFilterValueLength).append(", sortBy=")
|
||||||
.append(this.sortBy).append(", scope=").append(this.scope).append(", scopedSites=")
|
.append(this.sortBy).append(", scope=").append(this.scope).append(", scopedSites=")
|
||||||
.append(this.scopedSites).append(", index=").append(this.index).append(", isEnabled=").append(this.isEnabled)
|
.append(this.scopedSites).append(", index=").append(this.index).append(", isEnabled=").append(this.isEnabled)
|
||||||
.append("]");
|
.append(", isDefault=").append(this.isDefault).append("]");
|
||||||
return builder2.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder
|
public static class Builder
|
||||||
@@ -226,6 +258,7 @@ public class SolrFacetProperties
|
|||||||
private String filterID;
|
private String filterID;
|
||||||
private QName facetQName;
|
private QName facetQName;
|
||||||
private String displayName;
|
private String displayName;
|
||||||
|
private String displayControl;
|
||||||
private int maxFilters;
|
private int maxFilters;
|
||||||
private int hitThreshold;
|
private int hitThreshold;
|
||||||
private int minFilterValueLength;
|
private int minFilterValueLength;
|
||||||
@@ -234,6 +267,7 @@ public class SolrFacetProperties
|
|||||||
private Set<String> scopedSites;
|
private Set<String> scopedSites;
|
||||||
private int index;
|
private int index;
|
||||||
private boolean isEnabled;
|
private boolean isEnabled;
|
||||||
|
private boolean isDefault;
|
||||||
|
|
||||||
public Builder filterID(String filterID)
|
public Builder filterID(String filterID)
|
||||||
{
|
{
|
||||||
@@ -253,6 +287,12 @@ public class SolrFacetProperties
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder displayControl(String displayControl)
|
||||||
|
{
|
||||||
|
this.displayControl = displayControl;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder maxFilters(int maxFilters)
|
public Builder maxFilters(int maxFilters)
|
||||||
{
|
{
|
||||||
this.maxFilters = maxFilters;
|
this.maxFilters = maxFilters;
|
||||||
@@ -301,6 +341,12 @@ public class SolrFacetProperties
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder isDefault(boolean isDefault)
|
||||||
|
{
|
||||||
|
this.isDefault = isDefault;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public SolrFacetProperties build()
|
public SolrFacetProperties build()
|
||||||
{
|
{
|
||||||
return new SolrFacetProperties(this);
|
return new SolrFacetProperties(this);
|
||||||
|
@@ -21,7 +21,6 @@ package org.alfresco.repo.search.impl.solr.facet;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -54,6 +53,7 @@ import org.alfresco.service.cmr.security.PermissionService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
import org.alfresco.util.collections.CollectionUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
@@ -196,7 +196,8 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, SolrFacetProperties> getFacets()
|
public Map<String, SolrFacetProperties> getFacets()
|
||||||
{
|
{
|
||||||
return Collections.unmodifiableMap(facetsMap);
|
Map<String, SolrFacetProperties> sortedMap = CollectionUtils.sortMapByValue(facetsMap);
|
||||||
|
return sortedMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -254,6 +255,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
String filterID = (String) properties.get(ContentModel.PROP_NAME);
|
String filterID = (String) properties.get(ContentModel.PROP_NAME);
|
||||||
QName fieldQName = (QName) properties.get(SolrFacetModel.PROP_FIELD_TYPE);
|
QName fieldQName = (QName) properties.get(SolrFacetModel.PROP_FIELD_TYPE);
|
||||||
String displayName = (String) properties.get(SolrFacetModel.PROP_FIELD_LABEL);
|
String displayName = (String) properties.get(SolrFacetModel.PROP_FIELD_LABEL);
|
||||||
|
String displayControl = (String) properties.get(SolrFacetModel.PROP_DISPLAY_CONTROL);
|
||||||
int maxFilters = (Integer) properties.get(SolrFacetModel.PROP_MAX_FILTERS);
|
int maxFilters = (Integer) properties.get(SolrFacetModel.PROP_MAX_FILTERS);
|
||||||
int hitThreshold = (Integer) properties.get(SolrFacetModel.PROP_HIT_THRESHOLD);
|
int hitThreshold = (Integer) properties.get(SolrFacetModel.PROP_HIT_THRESHOLD);
|
||||||
int minFilterValueLength = (Integer) properties.get(SolrFacetModel.PROP_MIN_FILTER_VALUE_LENGTH);
|
int minFilterValueLength = (Integer) properties.get(SolrFacetModel.PROP_MIN_FILTER_VALUE_LENGTH);
|
||||||
@@ -261,6 +263,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
String scope = (String) properties.get(SolrFacetModel.PROP_SCOPE);
|
String scope = (String) properties.get(SolrFacetModel.PROP_SCOPE);
|
||||||
int index = (Integer) properties.get(SolrFacetModel.PROP_INDEX);
|
int index = (Integer) properties.get(SolrFacetModel.PROP_INDEX);
|
||||||
boolean isEnabled = (Boolean) properties.get(SolrFacetModel.PROP_IS_ENABLED);
|
boolean isEnabled = (Boolean) properties.get(SolrFacetModel.PROP_IS_ENABLED);
|
||||||
|
boolean isDefault = (Boolean) properties.get(SolrFacetModel.PROP_IS_DEFAULT);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<String> scSites = (List<String>) properties.get(SolrFacetModel.PROP_SCOPED_SITES);
|
List<String> scSites = (List<String>) properties.get(SolrFacetModel.PROP_SCOPED_SITES);
|
||||||
Set<String> scopedSites = (scSites == null) ? null : new HashSet<>(scSites);
|
Set<String> scopedSites = (scSites == null) ? null : new HashSet<>(scSites);
|
||||||
@@ -270,6 +273,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
.filterID(filterID)
|
.filterID(filterID)
|
||||||
.facetQName(fieldQName)
|
.facetQName(fieldQName)
|
||||||
.displayName(displayName)
|
.displayName(displayName)
|
||||||
|
.displayControl(displayControl)
|
||||||
.maxFilters(maxFilters)
|
.maxFilters(maxFilters)
|
||||||
.hitThreshold(hitThreshold)
|
.hitThreshold(hitThreshold)
|
||||||
.minFilterValueLength(minFilterValueLength)
|
.minFilterValueLength(minFilterValueLength)
|
||||||
@@ -277,6 +281,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
.scope(scope)
|
.scope(scope)
|
||||||
.index(index)
|
.index(index)
|
||||||
.isEnabled(isEnabled)
|
.isEnabled(isEnabled)
|
||||||
|
.isDefault(isDefault)
|
||||||
.scopedSites(scopedSites).build();
|
.scopedSites(scopedSites).build();
|
||||||
|
|
||||||
return fp;
|
return fp;
|
||||||
@@ -404,7 +409,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
throw new SolrFacetConfigException("Filter Id cannot be null.");
|
throw new SolrFacetConfigException("Filter Id cannot be null.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(11);
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(14);
|
||||||
|
|
||||||
if (withFilterId)
|
if (withFilterId)
|
||||||
{
|
{
|
||||||
@@ -412,6 +417,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
}
|
}
|
||||||
properties.put(SolrFacetModel.PROP_FIELD_TYPE, facetProperties.getFacetQName());
|
properties.put(SolrFacetModel.PROP_FIELD_TYPE, facetProperties.getFacetQName());
|
||||||
properties.put(SolrFacetModel.PROP_FIELD_LABEL, facetProperties.getDisplayName());
|
properties.put(SolrFacetModel.PROP_FIELD_LABEL, facetProperties.getDisplayName());
|
||||||
|
properties.put(SolrFacetModel.PROP_DISPLAY_CONTROL, facetProperties.getDisplayControl());
|
||||||
properties.put(SolrFacetModel.PROP_MAX_FILTERS, facetProperties.getMaxFilters());
|
properties.put(SolrFacetModel.PROP_MAX_FILTERS, facetProperties.getMaxFilters());
|
||||||
properties.put(SolrFacetModel.PROP_HIT_THRESHOLD, facetProperties.getHitThreshold());
|
properties.put(SolrFacetModel.PROP_HIT_THRESHOLD, facetProperties.getHitThreshold());
|
||||||
properties.put(SolrFacetModel.PROP_MIN_FILTER_VALUE_LENGTH, facetProperties.getMinFilterValueLength());
|
properties.put(SolrFacetModel.PROP_MIN_FILTER_VALUE_LENGTH, facetProperties.getMinFilterValueLength());
|
||||||
@@ -421,6 +427,9 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
properties.put(SolrFacetModel.PROP_INDEX, facetProperties.getIndex());
|
properties.put(SolrFacetModel.PROP_INDEX, facetProperties.getIndex());
|
||||||
properties.put(SolrFacetModel.PROP_IS_ENABLED, facetProperties.isEnabled());
|
properties.put(SolrFacetModel.PROP_IS_ENABLED, facetProperties.isEnabled());
|
||||||
|
|
||||||
|
SolrFacetProperties fp = facetConfig.getDefaultFacets().get(facetProperties.getFilterID());
|
||||||
|
properties.put(SolrFacetModel.PROP_IS_DEFAULT, (fp == null) ? false : fp.isDefault());
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,6 +540,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
{
|
{
|
||||||
SolrFacetProperties fp = getFacetProperties(childAssocRef.getChildRef());
|
SolrFacetProperties fp = getFacetProperties(childAssocRef.getChildRef());
|
||||||
this.facetsMap.put(fp.getFilterID(), fp);
|
this.facetsMap.put(fp.getFilterID(), fp);
|
||||||
|
this.facetNodeRefCache.put(fp.getFilterID(), childAssocRef.getChildRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -538,5 +548,6 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
|
|||||||
{
|
{
|
||||||
String filterID = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
String filterID = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||||
this.facetsMap.remove(filterID);
|
this.facetsMap.remove(filterID);
|
||||||
|
this.facetNodeRefCache.remove(filterID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user