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


Java MLAnalysisMode类代码示例

本文整理汇总了Java中org.alfresco.repo.search.MLAnalysisMode的典型用法代码示例。如果您正苦于以下问题:Java MLAnalysisMode类的具体用法?Java MLAnalysisMode怎么用?Java MLAnalysisMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MLAnalysisMode类属于org.alfresco.repo.search包,在下文中一共展示了MLAnalysisMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MLTokenDuplicator

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
/**
 *
 * @param locale
 * @param mlAnalysisMode
 */
public MLTokenDuplicator(Locale locale, MLAnalysisMode mlAnalysisMode)
{
    this.locale = locale;
    
    Collection<Locale> locales = MLAnalysisMode.getLocales(mlAnalysisMode, locale, false);
    prefixes = new HashSet<String>(locales.size());
    for(Locale toAdd : locales)
    {
        String localeString = toAdd.toString();
        if(localeString.length() == 0)
        {
            prefixes.add("");
        }
        else
        {
            StringBuilder builder = new StringBuilder(16);
            builder.append("{").append(localeString).append("}");
            prefixes.add(builder.toString());
        }
    }
    if(s_logger.isDebugEnabled())
    {
        s_logger.debug("Locale "+ locale +" using "+mlAnalysisMode+" is "+prefixes);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:31,代码来源:MLTokenDuplicator.java

示例2: Lucene4QueryBuilderContextSolrImpl

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
/**
     * Context for building lucene queries
     *
     * @param dictionaryService
     * @param namespacePrefixResolver
     * @param tenantService
     * @param searchParameters
     * @param defaultSearchMLAnalysisMode
     * @param req
     * @param model
     */
    public Lucene4QueryBuilderContextSolrImpl(DictionaryService dictionaryService, NamespacePrefixResolver namespacePrefixResolver, TenantService tenantService,
            SearchParameters searchParameters, MLAnalysisMode defaultSearchMLAnalysisMode, SolrQueryRequest req, AlfrescoSolrDataModel model, FTSQueryParser.RerankPhase rerankPhase)
    {
          lqp = new Solr4QueryParser(req.getSchema(), Version.LUCENE_48, searchParameters.getDefaultFieldName(), req.getSchema().getQueryAnalyzer(), rerankPhase);
//        lqp.setDefaultOperator(AbstractLuceneQueryParser.OR_OPERATOR);
        lqp.setDictionaryService(dictionaryService);
        lqp.setNamespacePrefixResolver(namespacePrefixResolver);
        lqp.setTenantService(tenantService);
          lqp.setSearchParameters(searchParameters);
//        lqp.setDefaultSearchMLAnalysisMode(defaultSearchMLAnalysisMode);
//        lqp.setIndexReader(indexReader);
//        lqp.setAllowLeadingWildcard(true);
//        this.namespacePrefixResolver = namespacePrefixResolver;
        
          Properties props = new CoreDescriptorDecorator(req.getCore().getCoreDescriptor()).getCoreProperties();
          int topTermSpanRewriteLimit = Integer.parseInt(props.getProperty("alfresco.topTermSpanRewriteLimit", "1000"));
          lqp.setTopTermSpanRewriteLimit(topTermSpanRewriteLimit);
          
          lqpa = new Lucene4QueryParserAdaptor(lqp);
    }
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:32,代码来源:Lucene4QueryBuilderContextSolrImpl.java

示例3: getWrappedAnalyzer

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
@Override
protected Analyzer getWrappedAnalyzer(String fieldName)
{
    if(fieldName.contains("[email protected]{"))
    {
        return new MLAnalayser(MLAnalysisMode.EXACT_LANGUAGE, schema, mode);
    }
    else if(fieldName.contains("[email protected]{"))
    {
         return new MLAnalayser(MLAnalysisMode.EXACT_LANGUAGE, schema, mode);
    }
    else
    {
        return schema.getFieldTypeByName("text___").getAnalyzer();
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:17,代码来源:AlfrescoAnalyzerWrapper.java

示例4: LuceneQueryBuilderContextSolrImpl

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
/**
 * Context for building lucene queries
 *
 * @param dictionaryService
 * @param namespacePrefixResolver
 * @param tenantService
 * @param searchParameters
 * @param defaultSearchMLAnalysisMode
 * @param indexReader
 * @param defaultAnalyzer
 * @param model
 */
public LuceneQueryBuilderContextSolrImpl(DictionaryService dictionaryService, NamespacePrefixResolver namespacePrefixResolver, TenantService tenantService,
        SearchParameters searchParameters, MLAnalysisMode defaultSearchMLAnalysisMode, IndexReader indexReader, Analyzer defaultAnalyzer, AlfrescoSolrDataModel model)
{
    SolrLuceneAnalyser analyzer = new SolrLuceneAnalyser(dictionaryService, searchParameters.getMlAnalaysisMode() == null ? defaultSearchMLAnalysisMode : searchParameters
            .getMlAnalaysisMode(), defaultAnalyzer, model);
    lqp = new SolrQueryParser(searchParameters.getDefaultFieldName(), analyzer);
    lqp.setDefaultOperator(AbstractLuceneQueryParser.OR_OPERATOR);
    lqp.setDictionaryService(dictionaryService);
    lqp.setNamespacePrefixResolver(namespacePrefixResolver);
    lqp.setTenantService(tenantService);
    lqp.setSearchParameters(searchParameters);
    lqp.setDefaultSearchMLAnalysisMode(defaultSearchMLAnalysisMode);
    lqp.setIndexReader(indexReader);
    lqp.setAllowLeadingWildcard(true);
    this.namespacePrefixResolver = namespacePrefixResolver;
    
    lqpa = new LegacyLuceneQueryParserAdaptor(lqp);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:31,代码来源:LuceneQueryBuilderContextSolrImpl.java

示例5: addLocaleSpecificUntokenisedTextRangeFunction

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
@Override
protected void addLocaleSpecificUntokenisedTextRangeFunction(String expandedFieldName, String lower, String upper, boolean includeLower, boolean includeUpper,
        LuceneFunction luceneFunction, BooleanQuery booleanQuery, MLAnalysisMode mlAnalysisMode, Locale locale, IndexTokenisationMode tokenisationMode) throws ParseException
{
    String field = getFieldName(expandedFieldName, locale, tokenisationMode, IndexTokenisationMode.FALSE);

    StringBuilder builder = new StringBuilder();
    builder.append("\u0000").append(locale.toString()).append("\u0000").append(lower);
    String first = getToken(field, builder.toString(), AnalysisMode.IDENTIFIER);

    builder = new StringBuilder();
    builder.append("\u0000").append(locale.toString()).append("\u0000").append(upper);
    String last = getToken(field, builder.toString(), AnalysisMode.IDENTIFIER);

    Query query = new CaseInsensitiveFieldRangeQuery(field, first, last, includeLower, includeUpper);
    booleanQuery.add(query, Occur.SHOULD);

}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:19,代码来源:SolrQueryParser.java

示例6: parse

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
/**
 * Parses a query string, returning a {@link org.apache.lucene.search.Query}.
 * 
 * @param query
 *            the query string to be parsed.
 * @param field
 *            the default field for query terms.
 * @param analyzer
 *            used to find terms in the query text.
 * @param namespacePrefixResolver NamespacePrefixResolver
 * @param dictionaryService DictionaryService
 * @param tenantService TenantService
 * @param defaultOperator Operator
 * @param searchParameters SearchParameters
 * @param defaultSearchMLAnalysisMode MLAnalysisMode
 * @param indexReader IndexReader
 * @return - the query
 * @throws ParseException
 *             if the parsing fails
 */
static public Query parse(String query, String field, Analyzer analyzer, NamespacePrefixResolver namespacePrefixResolver, DictionaryService dictionaryService,
        TenantService tenantService, Operator defaultOperator, SearchParameters searchParameters, MLAnalysisMode defaultSearchMLAnalysisMode, IndexReader indexReader)
        throws ParseException
{
    if (s_logger.isDebugEnabled())
    {
        s_logger.debug("Using Alfresco Lucene Query Parser for query: " + query);
    }
    LuceneQueryParser parser = new LuceneQueryParser(field, analyzer);
    parser.setDefaultOperator(defaultOperator);
    parser.setNamespacePrefixResolver(namespacePrefixResolver);
    parser.setDictionaryService(dictionaryService);
    parser.setTenantService(tenantService);
    parser.setSearchParameters(searchParameters);
    parser.setDefaultSearchMLAnalysisMode(defaultSearchMLAnalysisMode);
    parser.setIndexReader(indexReader);
    parser.setAllowLeadingWildcard(true);
    // TODO: Apply locale constraints at the top level if required for the non ML doc types.
    Query result = parser.parse(query);
    if (s_logger.isDebugEnabled())
    {
        s_logger.debug("Query " + query + "                             is\n\t" + result.toString());
    }
    return result;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:46,代码来源:LuceneQueryParser.java

示例7: addLocaleSpecificUntokenisedMLOrTextAttribute

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
private void addLocaleSpecificUntokenisedMLOrTextAttribute(String sourceField, String queryText, SubQuery subQueryBuilder, AnalysisMode analysisMode,
        LuceneFunction luceneFunction, BooleanQuery booleanQuery, MLAnalysisMode mlAnalysisMode, Locale locale, String actualField) throws ParseException
{

    String termText = queryText;
    if (locale.toString().length() > 0)
    {
        termText = "{" + locale + "}" + queryText;
    }
    Query subQuery = subQueryBuilder.getQuery(actualField, termText, analysisMode, luceneFunction);
    booleanQuery.add(subQuery, Occur.SHOULD);

    if (booleanQuery.getClauses().length == 0)
    {
        booleanQuery.add(createNoMatchQuery(), Occur.SHOULD);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:18,代码来源:LuceneQueryParser.java

示例8: LuceneQueryBuilderContextImpl

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
/**
 * Context for building lucene queries
 * 
 * @param dictionaryService
 * @param namespacePrefixResolver
 * @param tenantService
 * @param searchParameters
 * @param defaultSearchMLAnalysisMode
 * @param indexReader
 */
public LuceneQueryBuilderContextImpl(DictionaryService dictionaryService, NamespacePrefixResolver namespacePrefixResolver, TenantService tenantService,
        SearchParameters searchParameters, MLAnalysisMode defaultSearchMLAnalysisMode, IndexReader indexReader)
{
    LuceneAnalyser analyzer = new LuceneAnalyser(dictionaryService, searchParameters.getMlAnalaysisMode() == null ? defaultSearchMLAnalysisMode : searchParameters
            .getMlAnalaysisMode());
    lqp = new LuceneQueryParser(searchParameters.getDefaultFieldName(), analyzer);
    lqp.setDefaultOperator(AbstractLuceneQueryParser.OR_OPERATOR);
    lqp.setDictionaryService(dictionaryService);
    lqp.setNamespacePrefixResolver(namespacePrefixResolver);
    lqp.setTenantService(tenantService);
    lqp.setSearchParameters(searchParameters);
    lqp.setDefaultSearchMLAnalysisMode(defaultSearchMLAnalysisMode);
    lqp.setIndexReader(indexReader);
    lqp.setAllowLeadingWildcard(true);
    this.namespacePrefixResolver = namespacePrefixResolver;
    
    lqpa = new LegacyLuceneQueryParserAdaptor(lqp);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:29,代码来源:LuceneQueryBuilderContextImpl.java

示例9: setDefaultMLIndexAnalysisMode

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
/**
 * Set the ML analysis mode at index time.
 * 
 * @param mode MLAnalysisMode
 */
@Override
public void setDefaultMLIndexAnalysisMode(MLAnalysisMode mode)
{
    // defaultMLIndexAnalysisMode = MLAnalysisMode.getMLAnalysisMode(mode);
    defaultMLIndexAnalysisMode = mode;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

示例10: setDefaultMLSearchAnalysisMode

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
/**
 * Set the ML analysis mode at search time
 * 
 * @param mode MLAnalysisMode
 */
@Override
public void setDefaultMLSearchAnalysisMode(MLAnalysisMode mode)
{
    // defaultMLSearchAnalysisMode = MLAnalysisMode.getMLAnalysisMode(mode);
    defaultMLSearchAnalysisMode = mode;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

示例11: MLAnalayser

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
public MLAnalayser(MLAnalysisMode mlAnalaysisMode, IndexSchema schema, Mode mode)
{
    super(Analyzer.PER_FIELD_REUSE_STRATEGY);
    this.mlAnalaysisMode = mlAnalaysisMode;
    this.schema = schema;
    this.mode = mode;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:8,代码来源:MLAnalayser.java

示例12: MLTokenizer

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
MLTokenizer(String fieldName, Reader reader, IndexSchema schema, MLAnalysisMode mlAnalaysisMode, Mode mode) 
{
    super(reader);
    this.fieldName = fieldName;
    this.schema = schema;
    this.mlAnalaysisMode = mlAnalaysisMode;
    this.mode = mode;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:9,代码来源:MLAnalayser.java

示例13: addLocaleSpecificUntokenisedMLOrTextFunction

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
@Override
protected void addLocaleSpecificUntokenisedMLOrTextFunction(String expandedFieldName, String queryText, LuceneFunction luceneFunction, BooleanQuery booleanQuery,
        MLAnalysisMode mlAnalysisMode, Locale locale, IndexTokenisationMode tokenisationMode)
{
    Query subQuery = new CaseInsensitiveFieldQuery(new Term(getFieldName(expandedFieldName, locale, tokenisationMode, IndexTokenisationMode.FALSE), getFixedFunctionQueryText(
            queryText, locale, tokenisationMode, IndexTokenisationMode.FALSE)));
    booleanQuery.add(subQuery, Occur.SHOULD);

    if (booleanQuery.getClauses().length == 0)
    {
        booleanQuery.add(createNoMatchQuery(), Occur.SHOULD);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:14,代码来源:SolrQueryParser.java

示例14: addMLTextAttributeQuery

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
@Override
protected void addMLTextAttributeQuery(String field, String queryText, SubQuery subQueryBuilder, AnalysisMode analysisMode, LuceneFunction luceneFunction,
        String expandedFieldName, PropertyDefinition propertyDef, IndexTokenisationMode tokenisationMode, BooleanQuery booleanQuery, MLAnalysisMode mlAnalysisMode,
        Locale locale) throws ParseException
{

    addMLTextOrTextAttributeQuery(field, queryText, subQueryBuilder, analysisMode, luceneFunction, expandedFieldName, tokenisationMode, booleanQuery, mlAnalysisMode, locale);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:9,代码来源:SolrQueryParser.java

示例15: addTextAttributeQuery

import org.alfresco.repo.search.MLAnalysisMode; //导入依赖的package包/类
@Override
protected void addTextAttributeQuery(String field, String queryText, SubQuery subQueryBuilder, AnalysisMode analysisMode, LuceneFunction luceneFunction,
        String expandedFieldName, IndexTokenisationMode tokenisationMode, BooleanQuery booleanQuery, MLAnalysisMode mlAnalysisMode, Locale locale) throws ParseException
{

    addMLTextOrTextAttributeQuery(field, queryText, subQueryBuilder, analysisMode, luceneFunction, expandedFieldName, tokenisationMode, booleanQuery, mlAnalysisMode, locale);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:8,代码来源:SolrQueryParser.java


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