mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-9079: RSOLR 019: Lucene to SOLR switchover administration
- make solr base URL configurable git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29092 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -30,7 +30,14 @@
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="search.lucene.alfresco" class="org.alfresco.repo.search.impl.solr.SolrAlfrescoFTSQueryLanguage" >
|
||||
<bean id="search.abstract.query.language" abstract="true">
|
||||
<property name="baseUrl">
|
||||
<value>${solr.base.url}</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="search.lucene.alfresco" class="org.alfresco.repo.search.impl.solr.SolrAlfrescoFTSQueryLanguage"
|
||||
parent="search.abstract.query.language" >
|
||||
<property name="nodeDAO">
|
||||
<ref bean="nodeDAO" />
|
||||
</property>
|
||||
@@ -49,7 +56,8 @@
|
||||
|
||||
<!-- TODO: XPATH -->
|
||||
|
||||
<bean id="search.lucene.fts.alfresco" class="org.alfresco.repo.search.impl.solr.SolrAlfrescoFTSQueryLanguage" >
|
||||
<bean id="search.lucene.fts.alfresco" class="org.alfresco.repo.search.impl.solr.SolrAlfrescoFTSQueryLanguage"
|
||||
parent="search.abstract.query.language" >
|
||||
<property name="nodeDAO">
|
||||
<ref bean="nodeDAO" />
|
||||
</property>
|
||||
@@ -66,7 +74,8 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="search.solr.fts.alfresco" class="org.alfresco.repo.search.impl.solr.SolrAlfrescoFTSQueryLanguage" >
|
||||
<bean id="search.solr.fts.alfresco" class="org.alfresco.repo.search.impl.solr.SolrAlfrescoFTSQueryLanguage"
|
||||
parent="search.abstract.query.language" >
|
||||
<property name="nodeDAO">
|
||||
<ref bean="nodeDAO" />
|
||||
</property>
|
||||
@@ -80,7 +89,8 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="search.solr.cmis" class="org.alfresco.repo.search.impl.solr.SolrCMISQueryLanguage" >
|
||||
<bean id="search.solr.cmis" class="org.alfresco.repo.search.impl.solr.SolrCMISQueryLanguage"
|
||||
parent="search.abstract.query.language" >
|
||||
<property name="nodeDAO">
|
||||
<ref bean="nodeDAO" />
|
||||
</property>
|
||||
@@ -121,6 +131,9 @@
|
||||
<property name="queryRegister">
|
||||
<ref bean="search.queryRegisterComponent" />
|
||||
</property>
|
||||
<property name="baseUrl">
|
||||
<value>${solr.base.url}</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<alias name="search.indexerAndSearcherFactory" alias="search.admLuceneIndexerAndSearcherFactory"/>
|
||||
|
@@ -0,0 +1 @@
|
||||
solr.base.url=http://localhost:8080/solr
|
@@ -198,6 +198,8 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory extends AbstractIn
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
private boolean contentIndexingEnabled = true;
|
||||
|
||||
/**
|
||||
* Private constructor for the singleton TODO: FIt in with IOC
|
||||
*/
|
||||
@@ -1974,6 +1976,22 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory extends AbstractIn
|
||||
this.writerRamBufferSizeMb = writerRamBufferSizeMb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isContentIndexingEnabled()
|
||||
{
|
||||
return contentIndexingEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentIndexingEnabled(boolean contentIndexingEnabled)
|
||||
{
|
||||
this.contentIndexingEnabled = contentIndexingEnabled;
|
||||
|
||||
}
|
||||
|
||||
protected LuceneQueryLanguageSPI getQueryLanguage(String name)
|
||||
{
|
||||
return getQueryLanguages().get(name);
|
||||
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
package org.alfresco.repo.search.impl.solr;
|
||||
|
||||
import org.alfresco.repo.search.impl.lucene.AbstractLuceneQueryLanguage;
|
||||
|
||||
/**
|
||||
* @author Andy
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractSolrQueryLanguage extends AbstractLuceneQueryLanguage
|
||||
{
|
||||
private String baseUrl;
|
||||
|
||||
public String getBaseUrl()
|
||||
{
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl)
|
||||
{
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -61,7 +61,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
/**
|
||||
* @author Andy
|
||||
*/
|
||||
public class SolrAlfrescoFTSQueryLanguage extends AbstractLuceneQueryLanguage
|
||||
public class SolrAlfrescoFTSQueryLanguage extends AbstractSolrQueryLanguage
|
||||
{
|
||||
static Log s_logger = LogFactory.getLog(SolrAlfrescoFTSQueryLanguage.class);
|
||||
|
||||
@@ -104,7 +104,9 @@ public class SolrAlfrescoFTSQueryLanguage extends AbstractLuceneQueryLanguage
|
||||
httpClient.getParams().setBooleanParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, true);
|
||||
httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials("admin", "admin"));
|
||||
|
||||
StringBuilder url = new StringBuilder("http://localhost:8080/solr/alfresco/afts");
|
||||
StringBuilder url = new StringBuilder();
|
||||
url.append(getBaseUrl());
|
||||
url.append("/alfresco/afts");
|
||||
//duplicate the query in the URL
|
||||
url.append("?q=");
|
||||
URLCodec encoder = new URLCodec();
|
||||
|
@@ -58,7 +58,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
/**
|
||||
* @author Andy
|
||||
*/
|
||||
public class SolrCMISQueryLanguage extends AbstractLuceneQueryLanguage
|
||||
public class SolrCMISQueryLanguage extends AbstractSolrQueryLanguage
|
||||
{
|
||||
static Log s_logger = LogFactory.getLog(SolrCMISQueryLanguage.class);
|
||||
|
||||
@@ -103,8 +103,9 @@ public class SolrCMISQueryLanguage extends AbstractLuceneQueryLanguage
|
||||
httpClient.getParams().setBooleanParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, true);
|
||||
httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials("admin", "admin"));
|
||||
|
||||
StringBuilder url = new StringBuilder("http://localhost:8080/solr/alfresco/cmis");
|
||||
// duplicate the query in the URL
|
||||
StringBuilder url = new StringBuilder();
|
||||
url.append(getBaseUrl());
|
||||
url.append("/alfresco/cmis");
|
||||
url.append("?q=");
|
||||
URLCodec encoder = new URLCodec();
|
||||
url.append(encoder.encode(searchParameters.getQuery(), "UTF-8"));
|
||||
|
@@ -44,6 +44,7 @@ public class SolrIndexerAndSearcherFactory extends AbstractIndexerAndSearcher
|
||||
private NodeService nodeService;
|
||||
private QueryRegisterComponent queryRegister;
|
||||
private TenantService tenantService;
|
||||
private String baseUrl;
|
||||
|
||||
public DictionaryService getDictionaryService()
|
||||
{
|
||||
@@ -95,6 +96,16 @@ public class SolrIndexerAndSearcherFactory extends AbstractIndexerAndSearcher
|
||||
this.tenantService = tenantService;
|
||||
}
|
||||
|
||||
public String getBaseUrl()
|
||||
{
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl)
|
||||
{
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.search.IndexerAndSearcher#getIndexer(org.alfresco.service.cmr.repository.StoreRef)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user