Feature/search 2446 (#90)

* [SEARCH-2446]
Changes for supporting ElasticSearchSearchService
This commit is contained in:
Elia Porciani
2020-10-26 14:17:01 +01:00
committed by GitHub
parent 7b66fac26e
commit 5618700d16
16 changed files with 325 additions and 114 deletions

View File

@@ -50,23 +50,36 @@ import org.alfresco.service.namespace.QName;
@AlfrescoPublicApi @AlfrescoPublicApi
public interface SearchService public interface SearchService
{ {
public static final String LANGUAGE_LUCENE = "lucene"; String LANGUAGE_LUCENE = "lucene";
public static final String LANGUAGE_XPATH = "xpath"; String LANGUAGE_XPATH = "xpath";
public static final String LANGUAGE_FTS_ALFRESCO = "fts-alfresco"; String LANGUAGE_FTS_ALFRESCO = "fts-alfresco";
public static final String LANGUAGE_SOLR_FTS_ALFRESCO = "solr-fts-alfresco"; String LANGUAGE_CMIS_STRICT = "cmis-strict";
public static final String LANGUAGE_CMIS_STRICT = "cmis-strict"; String LANGUAGE_CMIS_ALFRESCO = "cmis-alfresco";
public static final String LANGUAGE_CMIS_ALFRESCO = "cmis-alfresco"; String LANGUAGE_INDEX_CMIS = "index-cmis";
public static final String LANGUAGE_SOLR_CMIS = "solr-cmis"; String LANGUAGE_INDEX_ALFRESCO = "index-alfresco";
public static final String LANGUAGE_SOLR_ALFRESCO = "solr-alfresco"; String LANGUAGE_INDEX_SQL = "index-sql";
public static final String LANGUAGE_SOLR_SQL = "solr-sql"; String LANGUAGE_INDEX_FTS_ALFRESCO = "index-fts-alfresco";
// Old language names for solr subsystems retro compatibility
@Deprecated
String LANGUAGE_SOLR_FTS_ALFRESCO = "solr-fts-alfresco";
@Deprecated
String LANGUAGE_SOLR_CMIS = "solr-cmis";
@Deprecated
String LANGUAGE_SOLR_ALFRESCO = "solr-alfresco";
@Deprecated
String LANGUAGE_SOLR_SQL = "solr-sql";
/** /**
* Search against a store. Pulls back all attributes on each node. Does not * Search against a store. Pulls back all attributes on each node. Does not
@@ -81,7 +94,7 @@ public interface SearchService
* @return Returns the query results * @return Returns the query results
*/ */
@Auditable(parameters = {"store", "language", "query"}) @Auditable(parameters = {"store", "language", "query"})
public ResultSet query(StoreRef store, String language, String query); ResultSet query(StoreRef store, String language, String query);
/** /**
* Search against a store. * Search against a store.
@@ -98,8 +111,8 @@ public interface SearchService
* @return Returns the query results * @return Returns the query results
*/ */
@Auditable(parameters = {"store", "language", "query", "queryParameterDefinitions"}) @Auditable(parameters = {"store", "language", "query", "queryParameterDefinitions"})
public ResultSet query(StoreRef store, String language, String query, ResultSet query(StoreRef store, String language, String query,
QueryParameterDefinition[] queryParameterDefinitions); QueryParameterDefinition[] queryParameterDefinitions);
/** /**
@@ -114,14 +127,14 @@ public interface SearchService
* @return Returns the query results * @return Returns the query results
*/ */
@Auditable(parameters = {"store", "queryId", "queryParameters"}) @Auditable(parameters = {"store", "queryId", "queryParameters"})
public ResultSet query(StoreRef store, QName queryId, QueryParameter[] queryParameters); ResultSet query(StoreRef store, QName queryId, QueryParameter[] queryParameters);
/** /**
* Search using the given SearchParameters * Search using the given SearchParameters
*/ */
@Auditable(parameters = {"searchParameters"}) @Auditable(parameters = {"searchParameters"})
public ResultSet query(SearchParameters searchParameters); ResultSet query(SearchParameters searchParameters);
/** /**
* Select nodes using an xpath expression. * Select nodes using an xpath expression.
@@ -143,8 +156,8 @@ public interface SearchService
parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks"}, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks"},
recordable = {true, true, true, false, true}) recordable = {true, true, true, false, true})
public List<NodeRef> selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, List<NodeRef> selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters,
NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks) NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks)
throws InvalidNodeRefException, XPathException; throws InvalidNodeRefException, XPathException;
/** /**
@@ -169,8 +182,8 @@ public interface SearchService
parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks", "language"}, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks", "language"},
recordable = {true, true, true, false, true, true}) recordable = {true, true, true, false, true, true})
public List<NodeRef> selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, List<NodeRef> selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters,
NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks, String language) NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks, String language)
throws InvalidNodeRefException, XPathException; throws InvalidNodeRefException, XPathException;
/** /**
@@ -193,9 +206,9 @@ public interface SearchService
parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks"}, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks"},
recordable = {true, true, true, false, true}) recordable = {true, true, true, false, true})
public List<Serializable> selectProperties(NodeRef contextNodeRef, String xpath, List<Serializable> selectProperties(NodeRef contextNodeRef, String xpath,
QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver,
boolean followAllParentLinks) throws InvalidNodeRefException, XPathException; boolean followAllParentLinks) throws InvalidNodeRefException, XPathException;
/** /**
* Select properties using an xpath expression * Select properties using an xpath expression
@@ -219,9 +232,9 @@ public interface SearchService
parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks", "language"}, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks", "language"},
recordable = {true, true, true, false, true, true}) recordable = {true, true, true, false, true, true})
public List<Serializable> selectProperties(NodeRef contextNodeRef, String xpath, List<Serializable> selectProperties(NodeRef contextNodeRef, String xpath,
QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver,
boolean followAllParentLinks, String language) throws InvalidNodeRefException, XPathException; boolean followAllParentLinks, String language) throws InvalidNodeRefException, XPathException;
/** /**
* Search for string pattern in both the node text (if present) and node * Search for string pattern in both the node text (if present) and node
@@ -236,7 +249,7 @@ public interface SearchService
* @return Returns true if the pattern could be found - uses the default OR operator * @return Returns true if the pattern could be found - uses the default OR operator
*/ */
@Auditable(parameters = {"nodeRef", "propertyQName", "googleLikePattern"}) @Auditable(parameters = {"nodeRef", "propertyQName", "googleLikePattern"})
public boolean contains(NodeRef nodeRef, QName propertyQName, String googleLikePattern) boolean contains(NodeRef nodeRef, QName propertyQName, String googleLikePattern)
throws InvalidNodeRefException; throws InvalidNodeRefException;
/** /**
@@ -252,7 +265,7 @@ public interface SearchService
* @return Returns true if the pattern could be found * @return Returns true if the pattern could be found
*/ */
@Auditable(parameters = {"nodeRef", "propertyQName", "googleLikePattern", "defaultOperator"}) @Auditable(parameters = {"nodeRef", "propertyQName", "googleLikePattern", "defaultOperator"})
public boolean contains(NodeRef nodeRef, QName propertyQName, String googleLikePattern, SearchParameters.Operator defaultOperator) boolean contains(NodeRef nodeRef, QName propertyQName, String googleLikePattern, SearchParameters.Operator defaultOperator)
throws InvalidNodeRefException; throws InvalidNodeRefException;
/** /**
@@ -270,6 +283,6 @@ public interface SearchService
* @return Returns true if the pattern could be found * @return Returns true if the pattern could be found
*/ */
@Auditable(parameters = {"nodeRef", "propertyQName", "sqlLikePattern", "includeFTS"}) @Auditable(parameters = {"nodeRef", "propertyQName", "sqlLikePattern", "includeFTS"})
public boolean like(NodeRef nodeRef, QName propertyQName, String sqlLikePattern, boolean includeFTS) boolean like(NodeRef nodeRef, QName propertyQName, String sqlLikePattern, boolean includeFTS)
throws InvalidNodeRefException; throws InvalidNodeRefException;
} }

View File

@@ -118,7 +118,7 @@ public class StatsGet extends DeclarativeWebScript
Pair<LocalDate, LocalDate> startAndEnd = getStartAndEndDates(req.getParameter("startDate"),req.getParameter("endDate")); Pair<LocalDate, LocalDate> startAndEnd = getStartAndEndDates(req.getParameter("startDate"),req.getParameter("endDate"));
query = buildQuery(siteInfo, facetKey, startAndEnd); query = buildQuery(siteInfo, facetKey, startAndEnd);
StatsParameters params = new StatsParameters(SearchService.LANGUAGE_SOLR_FTS_ALFRESCO, query, false); StatsParameters params = new StatsParameters(SearchService.LANGUAGE_INDEX_FTS_ALFRESCO, query, false);
//params.addSort(new SortDefinition(SortDefinition.SortType.FIELD, this.statsField, false)); //params.addSort(new SortDefinition(SortDefinition.SortType.FIELD, this.statsField, false));
params.addStatsParameter(StatsParameters.PARAM_FIELD, this.statsField); params.addStatsParameter(StatsParameters.PARAM_FIELD, this.statsField);
params.addStatsParameter(StatsParameters.PARAM_FACET, StatsParameters.FACET_PREFIX+propFacet.toString()); params.addStatsParameter(StatsParameters.PARAM_FACET, StatsParameters.FACET_PREFIX+propFacet.toString());

View File

@@ -123,7 +123,7 @@ public class SearchSQLApiWebscript extends AbstractWebScript implements Recogniz
public SearchParameters buildSearchParameters(SearchSQLQuery searchQuery) public SearchParameters buildSearchParameters(SearchSQLQuery searchQuery)
{ {
SearchParameters sparams = new SearchParameters(); SearchParameters sparams = new SearchParameters();
sparams.setLanguage(SearchService.LANGUAGE_SOLR_SQL); sparams.setLanguage(SearchService.LANGUAGE_INDEX_SQL);
sparams.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); sparams.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
if(StringUtils.isEmpty(searchQuery.getStmt())) if(StringUtils.isEmpty(searchQuery.getStmt()))
{ {

View File

@@ -377,7 +377,7 @@ public class SearchMapperTests
try try
{ {
searchParameters.setLanguage(SearchService.LANGUAGE_SOLR_ALFRESCO); searchParameters.setLanguage(SearchService.LANGUAGE_INDEX_ALFRESCO);
searchMapper.fromFilterQuery(searchParameters, Arrays.asList(new FilterQuery(null, null, null))); searchMapper.fromFilterQuery(searchParameters, Arrays.asList(new FilterQuery(null, null, null)));
fail(); fail();
} }

View File

@@ -0,0 +1,38 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.search.impl;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.search.impl.lucene.AbstractLuceneQueryLanguage;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
public class UnsupportedQueryLanguage extends AbstractLuceneQueryLanguage {
@Override
public ResultSet executeQuery(SearchParameters searchParameters) {
throw new AlfrescoRuntimeException("No support for language " + searchParameters.getLanguage());
}
}

View File

@@ -2,7 +2,7 @@
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2020 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
@@ -81,7 +81,7 @@ public class SolrCategoryServiceImpl extends AbstractCategoryServiceImpl
String field = "@" + catProperty; String field = "@" + catProperty;
SearchParameters sp = new SearchParameters(); SearchParameters sp = new SearchParameters();
sp.setLanguage(SearchService.LANGUAGE_SOLR_FTS_ALFRESCO); sp.setLanguage(SearchService.LANGUAGE_INDEX_FTS_ALFRESCO);
sp.addStore(storeRef); sp.addStore(storeRef);
sp.setQuery(catProperty+":*"); sp.setQuery(catProperty+":*");
FieldFacet ff = new FieldFacet(field); FieldFacet ff = new FieldFacet(field);

View File

@@ -2,7 +2,7 @@
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2020 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
@@ -55,7 +55,7 @@ public class SolrStatsService implements StatsService
searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
LuceneQueryLanguageSPI language = searcher.getQueryLanguages().get(searchParameters.getLanguage().toLowerCase()); LuceneQueryLanguageSPI language = searcher.getQueryLanguages().get(searchParameters.getLanguage().toLowerCase());
if (language != null && SearchService.LANGUAGE_SOLR_FTS_ALFRESCO.equals(language.getName())) if (language != null && SearchService.LANGUAGE_INDEX_FTS_ALFRESCO.equals(language.getName()))
{ {
SolrQueryLanguage solr = (SolrQueryLanguage) language; SolrQueryLanguage solr = (SolrQueryLanguage) language;
return solr.executeStatsQuery(searchParameters); return solr.executeStatsQuery(searchParameters);

View File

@@ -2,7 +2,7 @@
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2020 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
@@ -42,7 +42,7 @@ public class SolrXPathQueryLanguage extends AbstractLuceneQueryLanguage
{ {
String query = "PATH:\""+searchParameters.getQuery()+"\""; String query = "PATH:\""+searchParameters.getQuery()+"\"";
SearchParameters sp = searchParameters.copy(); SearchParameters sp = searchParameters.copy();
sp.setLanguage(SearchService.LANGUAGE_SOLR_FTS_ALFRESCO); sp.setLanguage(SearchService.LANGUAGE_INDEX_FTS_ALFRESCO);
sp.setQuery(query); sp.setQuery(query);
return solrQueryLanguage.executeQuery(sp); return solrQueryLanguage.executeQuery(sp);
} }

View File

@@ -107,7 +107,7 @@
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-fts-alfresco</value> <value>index-fts-alfresco</value>
</property> </property>
</bean> </bean>
@@ -118,7 +118,7 @@
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-cmis</value> <value>index-cmis</value>
</property> </property>
</bean> </bean>

View File

@@ -41,7 +41,7 @@
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-cmis</value> <value>index-cmis</value>
</property> </property>
<property name="solrQueryHTTPClient"> <property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" /> <ref bean="search.solrQueryHTTPCLient" />

View File

@@ -51,12 +51,16 @@
<property name="languageMappings"> <property name="languageMappings">
<map> <map>
<entry key="lucene" value="alfresco" /> <entry key="lucene" value="alfresco" />
<entry key="solr-alfresco" value="alfresco" /> <entry key="index-alfresco" value="alfresco" />
<entry key="cmis-strict" value="cmis" /> <entry key="cmis-strict" value="cmis" />
<entry key="cmis-alfresco" value="cmis" /> <entry key="cmis-alfresco" value="cmis" />
<entry key="solr-cmis" value="cmis" /> <entry key="index-cmis" value="cmis" />
<entry key="fts-alfresco" value="afts" /> <entry key="fts-alfresco" value="afts" />
<entry key="index-fts-alfresco" value="afts" />
<!-- Old solr language names-->
<entry key="solr-fts-alfresco" value="afts" /> <entry key="solr-fts-alfresco" value="afts" />
<entry key="solr-cmis" value="cmis" />
<entry key="solr-alfresco" value="alfresco" />
</map> </map>
</property> </property>
<property name="storeMappings"> <property name="storeMappings">
@@ -165,21 +169,21 @@
</bean> </bean>
<bean id="search.solr.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" > <bean id="search.index.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories"> <property name="factories">
<list> <list>
<ref bean="search.indexerAndSearcherFactory" /> <ref bean="search.indexerAndSearcherFactory" />
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-alfresco</value> <value>index-alfresco</value>
</property> </property>
<property name="solrQueryHTTPClient"> <property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" /> <ref bean="search.solrQueryHTTPCLient" />
</property> </property>
</bean> </bean>
<bean id="search.lucene.xpath" class="org.alfresco.repo.search.impl.solr.SolrXPathQueryLanguage" > <bean id="search.lucene.xpath" class="org.alfresco.repo.search.impl.solr.SolrXPathQueryLanguage" >
<property name="solrQueryLanguage" > <property name="solrQueryLanguage" >
<ref bean="search.fts.alfresco.index" /> <ref bean="search.fts.alfresco.index" />
@@ -195,6 +199,36 @@
</bean> </bean>
<bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" > <bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>index-fts-alfresco</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" />
</property>
</bean>
<!--queryLanguage instances with legacy names-->
<bean id="search.index.cmis" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>index-cmis</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" />
</property>
</bean>
<bean id="search.fts.alfresco.solr" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories"> <property name="factories">
<list> <list>
<ref bean="search.indexerAndSearcherFactory" /> <ref bean="search.indexerAndSearcherFactory" />
@@ -222,6 +256,20 @@
</property> </property>
</bean> </bean>
<bean id="search.solr.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>solr-alfresco</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" />
</property>
</bean>
<bean id="search.indexerAndSearcherFactory" class="org.alfresco.repo.service.StoreRedirectorProxyFactory"> <bean id="search.indexerAndSearcherFactory" class="org.alfresco.repo.service.StoreRedirectorProxyFactory">
<property name="proxyInterface"> <property name="proxyInterface">
<value>org.alfresco.repo.search.IndexerAndSearcher</value> <value>org.alfresco.repo.search.IndexerAndSearcher</value>

View File

@@ -41,7 +41,7 @@
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-cmis</value> <value>index-cmis</value>
</property> </property>
<property name="solrQueryHTTPClient"> <property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" /> <ref bean="search.solrQueryHTTPCLient" />

View File

@@ -52,12 +52,16 @@
<property name="languageMappings"> <property name="languageMappings">
<map> <map>
<entry key="lucene" value="alfresco" /> <entry key="lucene" value="alfresco" />
<entry key="solr-alfresco" value="alfresco" /> <entry key="index-alfresco" value="alfresco" />
<entry key="cmis-strict" value="cmis" /> <entry key="cmis-strict" value="cmis" />
<entry key="cmis-alfresco" value="cmis" /> <entry key="cmis-alfresco" value="cmis" />
<entry key="solr-cmis" value="cmis" /> <entry key="index-cmis" value="cmis" />
<entry key="fts-alfresco" value="afts" /> <entry key="fts-alfresco" value="afts" />
<entry key="index-fts-alfresco" value="afts" />
<!-- Old solr language names-->
<entry key="solr-fts-alfresco" value="afts" /> <entry key="solr-fts-alfresco" value="afts" />
<entry key="solr-cmis" value="cmis" />
<entry key="solr-alfresco" value="alfresco" />
</map> </map>
</property> </property>
<property name="storeMappings"> <property name="storeMappings">
@@ -186,19 +190,18 @@
</bean> </bean>
<bean id="search.solr.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" > <bean id="search.index.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories"> <property name="factories">
<list> <list>
<ref bean="search.indexerAndSearcherFactory" /> <ref bean="search.indexerAndSearcherFactory" />
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-alfresco</value> <value>index-alfresco</value>
</property> </property>
<property name="solrQueryHTTPClient"> <property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" /> <ref bean="search.solrQueryHTTPCLient" />
</property> </property>
</bean> </bean>
<bean id="search.lucene.xpath" class="org.alfresco.repo.search.impl.solr.SolrXPathQueryLanguage" > <bean id="search.lucene.xpath" class="org.alfresco.repo.search.impl.solr.SolrXPathQueryLanguage" >
@@ -216,6 +219,35 @@
</bean> </bean>
<bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" > <bean id="search.fts.alfresco.index" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>index-fts-alfresco</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" />
</property>
</bean>
<bean id="search.index.cmis" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>index-cmis</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" />
</property>
</bean>
<!--queryLanguage instances with legacy names-->
<bean id="search.fts.alfresco.solr" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories"> <property name="factories">
<list> <list>
<ref bean="search.indexerAndSearcherFactory" /> <ref bean="search.indexerAndSearcherFactory" />
@@ -243,6 +275,20 @@
</property> </property>
</bean> </bean>
<bean id="search.solr.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>solr-alfresco</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" />
</property>
</bean>
<bean id="search.indexerAndSearcherFactory" class="org.alfresco.repo.service.StoreRedirectorProxyFactory"> <bean id="search.indexerAndSearcherFactory" class="org.alfresco.repo.service.StoreRedirectorProxyFactory">
<property name="proxyInterface"> <property name="proxyInterface">
<value>org.alfresco.repo.search.IndexerAndSearcher</value> <value>org.alfresco.repo.search.IndexerAndSearcher</value>

View File

@@ -41,7 +41,7 @@
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-cmis</value> <value>index-cmis</value>
</property> </property>
<property name="solrQueryHTTPClient"> <property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" /> <ref bean="search.solrQueryHTTPCLient" />

View File

@@ -52,12 +52,16 @@
<property name="languageMappings"> <property name="languageMappings">
<map> <map>
<entry key="lucene" value="alfresco" /> <entry key="lucene" value="alfresco" />
<entry key="solr-alfresco" value="alfresco" /> <entry key="index-alfresco" value="alfresco" />
<entry key="cmis-strict" value="cmis" /> <entry key="cmis-strict" value="cmis" />
<entry key="cmis-alfresco" value="cmis" /> <entry key="cmis-alfresco" value="cmis" />
<entry key="solr-cmis" value="cmis" /> <entry key="index-cmis" value="cmis" />
<entry key="fts-alfresco" value="afts" /> <entry key="fts-alfresco" value="afts" />
<entry key="index-fts-alfresco" value="afts" />
<!-- Old solr language names-->
<entry key="solr-fts-alfresco" value="afts" /> <entry key="solr-fts-alfresco" value="afts" />
<entry key="solr-cmis" value="cmis" />
<entry key="solr-alfresco" value="alfresco" />
</map> </map>
</property> </property>
<property name="storeMappings"> <property name="storeMappings">
@@ -203,14 +207,14 @@
</bean> </bean>
<bean id="search.solr.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" > <bean id="search.index.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories"> <property name="factories">
<list> <list>
<ref bean="search.indexerAndSearcherFactory" /> <ref bean="search.indexerAndSearcherFactory" />
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-alfresco</value> <value>index-alfresco</value>
</property> </property>
<property name="solrQueryHTTPClient"> <property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" /> <ref bean="search.solrQueryHTTPCLient" />
@@ -239,26 +243,55 @@
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-fts-alfresco</value> <value>index-fts-alfresco</value>
</property> </property>
<property name="solrQueryHTTPClient"> <property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" /> <ref bean="search.solrQueryHTTPCLient" />
</property> </property>
</bean> </bean>
<!-- Adding solr SQL language. --> <!-- Adding solr SQL language. -->
<bean id="search.solr.sql.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage"> <bean id="search.index.sql.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage">
<property name="factories"> <property name="factories">
<list> <list>
<ref bean="search.indexerAndSearcherFactory" /> <ref bean="search.indexerAndSearcherFactory" />
</list> </list>
</property> </property>
<property name="name"> <property name="name">
<value>solr-sql</value> <value>index-sql</value>
</property> </property>
<property name="solrQueryHTTPClient"> <property name="solrQueryHTTPClient">
<ref bean="search.solrSQLQueryHTTPCLient" /> <ref bean="search.solrSQLQueryHTTPCLient" />
</property> </property>
</bean> </bean>
<bean id="search.index.cmis" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>index-cmis</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" />
</property>
</bean>
<!--queryLanguage instances with legacy names-->
<bean id="search.fts.alfresco.solr" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>solr-fts-alfresco</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" />
</property>
</bean>
<bean id="search.solr.cmis" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" > <bean id="search.solr.cmis" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories"> <property name="factories">
<list> <list>
@@ -273,6 +306,34 @@
</property> </property>
</bean> </bean>
<bean id="search.solr.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage" >
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>solr-alfresco</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrQueryHTTPCLient" />
</property>
</bean>
<bean id="search.solr.sql.alfresco" class="org.alfresco.repo.search.impl.solr.SolrQueryLanguage">
<property name="factories">
<list>
<ref bean="search.indexerAndSearcherFactory" />
</list>
</property>
<property name="name">
<value>solr-sql</value>
</property>
<property name="solrQueryHTTPClient">
<ref bean="search.solrSQLQueryHTTPCLient" />
</property>
</bean>
<bean id="search.indexerAndSearcherFactory" class="org.alfresco.repo.service.StoreRedirectorProxyFactory"> <bean id="search.indexerAndSearcherFactory" class="org.alfresco.repo.service.StoreRedirectorProxyFactory">
<property name="proxyInterface"> <property name="proxyInterface">
<value>org.alfresco.repo.search.IndexerAndSearcher</value> <value>org.alfresco.repo.search.IndexerAndSearcher</value>

View File

@@ -94,6 +94,11 @@ public class SolrQueryHTTPClientTest
public static void setUpBeforeClass() throws Exception public static void setUpBeforeClass() throws Exception
{ {
Map<String, String> languageMappings = new HashMap<String, String>(); Map<String, String> languageMappings = new HashMap<String, String>();
languageMappings.put("index-alfresco", "alfresco");
languageMappings.put("index-fts-alfresco", "afts");
languageMappings.put("index-cmis", "cmis");
// Old solr language names
languageMappings.put("solr-alfresco", "alfresco"); languageMappings.put("solr-alfresco", "alfresco");
languageMappings.put("solr-fts-alfresco", "afts"); languageMappings.put("solr-fts-alfresco", "afts");
languageMappings.put("solr-cmis", "cmis"); languageMappings.put("solr-cmis", "cmis");
@@ -165,7 +170,7 @@ public class SolrQueryHTTPClientTest
StringBuilder luceneQuery = new StringBuilder(); StringBuilder luceneQuery = new StringBuilder();
luceneQuery.append(" +TYPE:\"" + ContentModel.TYPE_CONTENT + "\""); luceneQuery.append(" +TYPE:\"" + ContentModel.TYPE_CONTENT + "\"");
String filterQuery = "ANCESTOR:\"workspace://SpacesStore/a1c1a0a1-9d68-4912-b853-b3b277f31288\""; String filterQuery = "ANCESTOR:\"workspace://SpacesStore/a1c1a0a1-9d68-4912-b853-b3b277f31288\"";
StatsParameters params = new StatsParameters(SearchService.LANGUAGE_SOLR_FTS_ALFRESCO, luceneQuery.toString(), filterQuery, false); StatsParameters params = new StatsParameters(SearchService.LANGUAGE_INDEX_FTS_ALFRESCO, luceneQuery.toString(), filterQuery, false);
params.addSort(new SortDefinition(SortDefinition.SortType.FIELD, "contentsize", false)); params.addSort(new SortDefinition(SortDefinition.SortType.FIELD, "contentsize", false));
params.addStatsParameter(StatsParameters.PARAM_FIELD, "contentsize"); params.addStatsParameter(StatsParameters.PARAM_FIELD, "contentsize");
params.addStatsParameter(StatsParameters.PARAM_FACET, StatsParameters.FACET_PREFIX + ContentModel.PROP_CREATED.toString()); params.addStatsParameter(StatsParameters.PARAM_FACET, StatsParameters.FACET_PREFIX + ContentModel.PROP_CREATED.toString());