mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
SEARCH-347, fix to skip TMDQ when faceting is involved
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@136049 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -182,7 +182,8 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
case TRANSACTIONAL_IF_POSSIBLE:
|
case TRANSACTIONAL_IF_POSSIBLE:
|
||||||
default:
|
default:
|
||||||
StopWatch stopWatch = new StopWatch("DB if possible");
|
StopWatch stopWatch = new StopWatch("DB if possible");
|
||||||
if(dbQueryLanguage != null)
|
//SEARCH-347, exclude TMDQ calls if faceting present.
|
||||||
|
if(dbQueryLanguage != null && !hasFaceting(searchParameters))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -251,8 +252,6 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
}
|
}
|
||||||
throw new QueryModelException("No query language available");
|
throw new QueryModelException("No query language available");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchParameters flattenDBQuery(SearchParameters sp)
|
private SearchParameters flattenDBQuery(SearchParameters sp)
|
||||||
@@ -285,6 +284,24 @@ public class DbOrIndexSwitchingQueryLanguage extends AbstractLuceneQueryLanguage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if faceted fields or faceted queries are present if so it needs
|
||||||
|
* to be excluded from the TMDQ call.
|
||||||
|
* @param searchParameters
|
||||||
|
* @return true if exists
|
||||||
|
*/
|
||||||
|
private boolean hasFaceting(SearchParameters searchParameters)
|
||||||
|
{
|
||||||
|
if(searchParameters.getFacetQueries() != null && !searchParameters.getFacetQueries().isEmpty())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(searchParameters.getFieldFacets() != null && !searchParameters.getFieldFacets().isEmpty())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
private ResultSet executeHybridQuery(SearchParameters searchParameters,
|
private ResultSet executeHybridQuery(SearchParameters searchParameters,
|
||||||
ADMLuceneSearcherImpl admLuceneSearcher)
|
ADMLuceneSearcherImpl admLuceneSearcher)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user