Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

85082: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud)
      84493: ACE-2637: Initial implementation of spell-check feature.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85397 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-09-20 10:51:27 +00:00
parent 2aef07876d
commit 5142297ac0
12 changed files with 360 additions and 17 deletions

View File

@@ -48,6 +48,7 @@ import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchParameters.FieldFacet;
import org.alfresco.service.cmr.search.SearchParameters.Operator;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.search.SpellCheckResult;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.util.ISO9075;
@@ -585,6 +586,8 @@ public class Search extends BaseScopableProcessorExtension implements Initializi
String onerror = (String)def.get("onerror");
String defaultField = (String)def.get("defaultField");
String defaultOperator = (String)def.get("defaultOperator");
String searchTerm = (String) def.get("searchTerm");
boolean spellCheck = (boolean) def.get("spellCheck");
// extract supplied values
@@ -666,6 +669,8 @@ public class Search extends BaseScopableProcessorExtension implements Initializi
sp.addStore(store != null ? new StoreRef(store) : this.storeRef);
sp.setLanguage(language != null ? language : SearchService.LANGUAGE_LUCENE);
sp.setQuery(query);
sp.setSearchTerm(searchTerm);
sp.setSpellCheck(spellCheck);
if (defaultField != null)
{
sp.setDefaultFieldName(defaultField);
@@ -985,6 +990,13 @@ public class Search extends BaseScopableProcessorExtension implements Initializi
}
}// End of bucketing
meta.put("facets", facetMeta);
SpellCheckResult spellCheckResult = results.getSpellCheckResult();
meta.put("spellcheck", new ScriptSpellCheckResult(
sp.getSearchTerm(),
spellCheckResult.getResultName(),
spellCheckResult.isSearchedFor(),
spellCheckResult.getResults(),
spellCheckResult.isSpellCheckExist()));
}
catch (Throwable err)
{