當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。