当前位置: 首页>>代码示例>>Java>>正文


Java SearcherException类代码示例

本文整理汇总了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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ADMLuceneSearcherImpl.java

示例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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ADMLuceneSearcherImpl.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

示例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());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:SolrStatsService.java

示例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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:RepositoryLocation.java

示例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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:PersonServiceImpl.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:ADMLuceneIndexerAndSearcherFactory.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:ADMLuceneIndexerAndSearcherFactory.java

示例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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:LuceneResultSet.java

示例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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:LuceneResultSet.java

示例11: close

import org.alfresco.repo.search.SearcherException; //导入依赖的package包/类
public void close()
{
    try
    {
        searcher.close();
    }
    catch (IOException e)
    {
        throw new SearcherException(e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:LuceneResultSet.java

示例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");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:LuceneResultSet.java

示例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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:LuceneResultSet.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:NoIndexIndexerAndSearcherFactory.java

示例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());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:SolrSearchService.java


注:本文中的org.alfresco.repo.search.SearcherException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。