mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1)
129058 jvonka: V1 REST API: Sites Live Search (/queries/live-search-sites) - additional tweaks based on ADs review comments REPO-232, REPO-883 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@129198 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -269,6 +269,15 @@ public class QueriesImpl implements Queries, InitializingBean
|
||||
{
|
||||
return nodes.getFolderOrDocument(nodeRef, null, null, includeParam, mapUserInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String escapeTerm(String term)
|
||||
{
|
||||
term = term.trim();
|
||||
term = SearchLanguageConversion.escapeLuceneQuery(term);
|
||||
return term;
|
||||
}
|
||||
|
||||
}.find(parameters, PARAM_TERM, MIN_TERM_LENGTH_NODES, "keywords",
|
||||
IN_QUERY_SORT, NODE_SORT_PARAMS_TO_QNAMES,
|
||||
new SortColumn(PARAM_MODIFIEDAT, false));
|
||||
@@ -346,15 +355,7 @@ public class QueriesImpl implements Queries, InitializingBean
|
||||
query.append(term);
|
||||
query.append("*\")");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTerm(Parameters parameters, String termName, int minTermLength)
|
||||
{
|
||||
String filter = super.getTerm(parameters, termName, minTermLength);
|
||||
String escNameFilter = SearchLanguageConversion.escapeLuceneQuery(filter.replace('"', ' '));
|
||||
return escNameFilter;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected List<Site> newList(int capacity)
|
||||
{
|
||||
@@ -497,9 +498,9 @@ public class QueriesImpl implements Queries, InitializingBean
|
||||
{
|
||||
throw new InvalidArgumentException("Query '"+termName+"' not specified");
|
||||
}
|
||||
|
||||
term = term.trim();
|
||||
term = term.replace("\"", "");
|
||||
|
||||
term = escapeTerm(term);
|
||||
|
||||
int cnt = 0;
|
||||
for (int i = 0; i < term.length(); i++)
|
||||
{
|
||||
@@ -522,6 +523,20 @@ public class QueriesImpl implements Queries, InitializingBean
|
||||
return term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim and escape the term - override if needed
|
||||
*
|
||||
* @param term
|
||||
* @return
|
||||
*/
|
||||
protected String escapeTerm(String term)
|
||||
{
|
||||
term = term.trim();
|
||||
term = term.replace("\"", "");
|
||||
term = SearchLanguageConversion.escapeLuceneQuery(term);
|
||||
return term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds sort order to the SearchParameters.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user