本文整理汇总了Java中org.alfresco.repo.search.SearcherException类的典型用法代码示例。如果您正苦于以下问题:Java SearcherException类的具体用法?Java SearcherException怎么用?Java SearcherException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SearcherException类属于org.alfresco.repo.search包,在下文中一共展示了SearcherException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSearcher
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
/**
* Get an initialised searcher for the store and transaction Normally we do not search against a a store and delta.
* Currently only gets the searcher against the main index.
*
* @param storeRef StoreRef
* @param indexer LuceneIndexer
* @param config LuceneConfig
* @return - the searcher implementation
*/
public static ADMLuceneSearcherImpl getSearcher(StoreRef storeRef, LuceneIndexer indexer, LuceneConfig config)
{
ADMLuceneSearcherImpl searcher = new ADMLuceneSearcherImpl();
searcher.setLuceneConfig(config);
try
{
searcher.initialise(storeRef, indexer == null ? null : indexer.getDeltaId());
searcher.indexer = indexer;
}
catch (LuceneIndexException e)
{
throw new SearcherException(e);
}
return searcher;
}
示例2: query
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
public ResultSet query(StoreRef store, String language, String queryString, QueryParameterDefinition[] queryParameterDefinitions) throws SearcherException
{
store = tenantService.getName(store);
SearchParameters sp = new SearchParameters();
sp.addStore(store);
sp.setLanguage(language);
sp.setQuery(queryString);
if (queryParameterDefinitions != null)
{
for (QueryParameterDefinition qpd : queryParameterDefinitions)
{
sp.addQueryParameterDefinition(qpd);
}
}
sp.excludeDataInTheCurrentTransaction(true);
return query(sp);
}
示例3: getSearcher
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
/**
* Encapsulate creating a searcher over the main index
*/
public LuceneSearcher getSearcher(StoreRef storeRef, boolean searchDelta) throws SearcherException
{
storeRef = tenantService.getName(storeRef);
String deltaId = null;
LuceneIndexer indexer = null;
if (searchDelta)
{
deltaId = getTransactionId(getTransaction(), storeRef);
if (deltaId != null)
{
indexer = getIndexer(storeRef);
}
}
LuceneSearcher searcher = getSearcher(storeRef, indexer);
return searcher;
}
示例4: query
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
@Override
public StatsResultSet query(StatsParameters searchParameters)
{
searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
LuceneQueryLanguageSPI language = searcher.getQueryLanguages().get(searchParameters.getLanguage().toLowerCase());
if (language != null && SearchService.LANGUAGE_SOLR_FTS_ALFRESCO.equals(language.getName()))
{
SolrQueryLanguage solr = (SolrQueryLanguage) language;
return solr.executeStatsQuery(searchParameters);
}
else
{
throw new SearcherException("Unknown stats query language: " + searchParameters.getLanguage());
}
}
示例5: setQueryLanguage
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
/**
* Set the query language
*
* @param queryLanguage the search language
*/
public void setQueryLanguage(String queryLanguage)
{
if (queryLanguage.equals(SearchService.LANGUAGE_LUCENE) ||
queryLanguage.equals(SearchService.LANGUAGE_XPATH) ||
queryLanguage.equals(LANGUAGE_PATH) ||
queryLanguage.equals(LANGUAGE_CLASSPATH))
{
this.queryLanguage = queryLanguage;
}
else
{
throw new SearcherException("Unknown query language: " + queryLanguage);
}
}
示例6: getNotifyEmailTemplateNodeRef
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
/**
* Finds the email template and then attempts to find a localized version
*/
private NodeRef getNotifyEmailTemplateNodeRef()
{
// Find the new user email template
String xpath = "app:company_home/app:dictionary/app:email_templates/cm:invite/cm:new-user-email.html.ftl";
try
{
NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
List<NodeRef> nodeRefs = searchService.selectNodes(
rootNodeRef,
xpath,
null,
getNamespaceService(),
false);
if (nodeRefs.size() > 1)
{
logger.error("Found too many email templates using: " + xpath);
nodeRefs = Collections.singletonList(nodeRefs.get(0));
}
else if (nodeRefs.size() == 0)
{
throw new InvitationException("Cannot find the email template using " + xpath);
}
// Now localise this
NodeRef base = nodeRefs.get(0);
NodeRef local = getFileFolderService().getLocalizedSibling(base);
return local;
}
catch (SearcherException e)
{
throw new InvitationException("Cannot find the email template!", e);
}
}
示例7: getSearcher
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
protected LuceneSearcher getSearcher(StoreRef storeRef, LuceneIndexer indexer) throws SearcherException
{
storeRef = tenantService.getName(storeRef);
ADMLuceneSearcherImpl searcher = ADMLuceneSearcherImpl.getSearcher(storeRef, indexer, this);
searcher.setNamespacePrefixResolver(nameSpaceService);
// searcher.setLuceneIndexLock(luceneIndexLock);
searcher.setNodeService(nodeService);
searcher.setTenantService(tenantService);
searcher.setDictionaryService(dictionaryService);
searcher.setQueryRegister(getQueryRegister());
searcher.setDictionaryService(dictionaryService);
searcher.setQueryLanguages(getQueryLanguages());
return searcher;
}
示例8: getNodeSearcher
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
protected SearchService getNodeSearcher() throws SearcherException
{
ADMLuceneSearcherImpl searcher = ADMLuceneSearcherImpl.getNodeSearcher();
searcher.setNamespacePrefixResolver(nameSpaceService);
searcher.setNodeService(nodeService);
searcher.setTenantService(tenantService);
searcher.setDictionaryService(dictionaryService);
searcher.setQueryRegister(getQueryRegister());
searcher.setDictionaryService(dictionaryService);
searcher.setQueryLanguages(getQueryLanguages());
return searcher;
}
示例9: getScore
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
public float getScore(int n) throws SearcherException
{
try
{
return hits.score(n);
}
catch (IOException e)
{
throw new SearcherException("IO Error reading score from the result set", e);
}
}
示例10: getDocument
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
public Document getDocument(int n)
{
try
{
prefetch(n);
Document doc = hits.doc(n);
return doc;
}
catch (IOException e)
{
throw new SearcherException("IO Error reading reading document from the result set", e);
}
}
示例11: close
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
public void close()
{
try
{
searcher.close();
}
catch (IOException e)
{
throw new SearcherException(e);
}
}
示例12: getRow
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
public ResultSetRow getRow(int i)
{
if (i < length())
{
return new LuceneResultSetRow(this, i);
}
else
{
throw new SearcherException("Invalid row");
}
}
示例13: doc
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
/**
* @param index int
* @return int
*/
public int doc(int index)
{
try
{
return hits.id(index);
}
catch (IOException e)
{
throw new SearcherException(e);
}
}
示例14: getSearcher
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
@Override
public SearchService getSearcher(StoreRef storeRef, boolean searchDelta) throws SearcherException
{
NoIndexSearchService searchService = new NoIndexSearchService();
searchService.setDictionaryService(getDictionaryService());
searchService.setNamespacePrefixResolver(getNamespacePrefixResolver());
searchService.setNodeService(getNodeService());
searchService.setQueryLanguages(getQueryLanguages());
searchService.setQueryRegister(getQueryRegister());
return searchService;
}
示例15: query
import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
@Override
public ResultSet query(SearchParameters searchParameters)
{
if(searchParameters.getStores().size() == 0)
{
throw new IllegalStateException("At least one store must be defined to search");
}
String parameterisedQueryString;
if (searchParameters.getQueryParameterDefinitions().size() > 0)
{
Map<QName, QueryParameterDefinition> map = new HashMap<QName, QueryParameterDefinition>();
for (QueryParameterDefinition qpd : searchParameters.getQueryParameterDefinitions())
{
map.put(qpd.getQName(), qpd);
}
parameterisedQueryString = parameterise(searchParameters.getQuery(), map, null, namespacePrefixResolver);
}
else
{
parameterisedQueryString = searchParameters.getQuery();
}
// TODO: add another property so the set query is not changed ...
// May be good to return the query as run ??
searchParameters.setQuery(parameterisedQueryString);
LuceneQueryLanguageSPI language = queryLanguages.get(searchParameters.getLanguage().toLowerCase());
if (language != null)
{
return language.executeQuery(searchParameters, null);
}
else
{
throw new SearcherException("Unknown query language: " + searchParameters.getLanguage());
}
}