Merged HEAD-BUG-FIX (Cloud33/4.3) to HEAD (Cloud33/4.3)

62920: Merged PLATFORM1 (Cloud33) to HEAD-BUG-FIX (Cloud33/4.3)
      << This was a bad merge with conflicts to do with the impl/solr directory not existing >>
      62511: ACE-482: Hybrid search can be disabled/enabled and is disabled by default.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62975 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-20 14:37:41 +00:00
parent 4e6a415eb2
commit 1a7fd86ee2
10 changed files with 425 additions and 2 deletions

View File

@@ -41,6 +41,11 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
LuceneQueryLanguageSPI indexQueryLanguage;
QueryConsistency queryConsistency = QueryConsistency.DEFAULT;
private NodeService nodeService;
private SOLRDAO solrDao;
private boolean hybridEnabled;
/**
* @param dbQueryLanguage the dbQueryLanguage to set
@@ -70,7 +75,20 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
this.queryConsistency = queryConsistency;
}
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
public void setSolrDao(SOLRDAO solrDao)
{
this.solrDao = solrDao;
}
public void setHybridEnabled(boolean hybridEnabled)
{
this.hybridEnabled = hybridEnabled;
}
public ResultSet executeQuery(SearchParameters searchParameters, ADMLuceneSearcherImpl admLuceneSearcher)
{
@@ -108,6 +126,12 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
{
throw new QueryModelException("No query language available");
}
case HYBRID:
if (!hybridEnabled)
{
throw new DisabledFeatureException("Hybrid query is disabled.");
}
return executeHybridQuery(searchParameters, admLuceneSearcher);
case DEFAULT:
case TRANSACTIONAL_IF_POSSIBLE:
default:

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2005-2014 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;
/**
* Identifies an attempt to use a disabled feature.
*
* @author Matt Ward
*/
public class DisabledFeatureException extends RuntimeException
{
private static final long serialVersionUID = 1L;
DisabledFeatureException(String message)
{
super(message);
}
}