本文整理汇总了Java中org.alfresco.repo.search.adaptor.lucene.AnalysisMode类的典型用法代码示例。如果您正苦于以下问题:Java AnalysisMode类的具体用法?Java AnalysisMode怎么用?Java AnalysisMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnalysisMode类属于org.alfresco.repo.search.adaptor.lucene包,在下文中一共展示了AnalysisMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addComponent
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_FROM_INC);
Boolean fromInc = (Boolean) argument.getValue(functionContext);
argument = functionArgs.get(ARG_FROM);
String from = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_TO);
String to = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_TO_INC);
Boolean toInc = (Boolean) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getRangeQuery(functionContext.getLuceneFieldName(prop), from, to, fromInc, toInc, AnalysisMode.DEFAULT, LuceneFunction.FIELD);
}
else
{
query = lqpa.getRangeQuery(lqpa.getField(), from, to, fromInc, toInc, AnalysisMode.DEFAULT, LuceneFunction.FIELD);
}
return query;
}
示例2: addComponent
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_TERM);
String term = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_TOKENISATION_MODE);
AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getFieldQuery(functionContext.getLuceneFieldName(prop), term, mode, LuceneFunction.FIELD);
}
else
{
query = lqpa.getFieldQuery(lqpa.getField(), term, mode, LuceneFunction.FIELD);
}
return query;
}
示例3: addComponent
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_TERM);
String term = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_TOKENISATION_MODE);
AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getWildcardQuery(functionContext.getLuceneFieldName(prop), term, mode);
}
else
{
query = lqpa.getWildcardQuery(lqpa.getField(), term, mode);
}
return query;
}
示例4: addComponent
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_TERM);
String term = (String) argument.getValue(functionContext);
// strip trailing wildcard *
term = term.substring(0, term.length()-1);
argument = functionArgs.get(ARG_TOKENISATION_MODE);
AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getPrefixQuery(functionContext.getLuceneFieldName(prop), term, mode);
}
else
{
query = lqpa.getPrefixQuery(lqpa.getField(), term, mode);
}
return query;
}
示例5: getDoesNotMatchFieldQuery
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
/**
* @param field
* @param queryText
* @param analysisMode
* @param luceneFunction
* @return the query
* @throws ParseException
* @throws IOException
*/
public Query getDoesNotMatchFieldQuery(String field, String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException
{
BooleanQuery query = new BooleanQuery();
Query allQuery = new MatchAllDocsQuery();
Query matchQuery = getFieldQuery(field, queryText, analysisMode, luceneFunction);
if ((matchQuery != null))
{
query.add(allQuery, Occur.MUST);
query.add(matchQuery, Occur.MUST_NOT);
}
else
{
throw new UnsupportedOperationException();
}
return query;
}
示例6: createDataTypeDefinitionQuery
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
protected Query createDataTypeDefinitionQuery(String field, String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException
{
Collection<QName> contentAttributes = dictionaryService.getAllProperties(QueryParserUtils.matchDataTypeDefinition(searchParameters.getNamespace(), namespacePrefixResolver, dictionaryService,field).getName());
BooleanQuery query = new BooleanQuery();
for (QName qname : contentAttributes)
{
// The super implementation will create phrase queries etc if required
Query part = getFieldQuery(PROPERTY_FIELD_PREFIX + qname.toString(), queryText, analysisMode, luceneFunction);
if (part != null)
{
query.add(part, Occur.SHOULD);
}
else
{
query.add(createNoMatchQuery(), Occur.SHOULD);
}
}
return query;
}
示例7: createExistsQuery
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
protected Query createExistsQuery(String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException
{
PropertyDefinition pd = QueryParserUtils.matchPropertyDefinition(searchParameters.getNamespace(), namespacePrefixResolver, dictionaryService, queryText);
if (pd != null)
{
return createTermQuery(FIELD_PROPERTIES, pd.getName().toString());
}
else
{
BooleanQuery query = new BooleanQuery();
Query presenceQuery = getWildcardQuery(queryText, "*");
if (presenceQuery != null)
{
query.add(createIsNodeQuery("T"), Occur.MUST);
query.add(presenceQuery, Occur.MUST_NOT);
}
return query;
}
}
示例8: addLocaleSpecificMLOrTextAttribute
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
private void addLocaleSpecificMLOrTextAttribute(PropertyDefinition pDef, String queryText, SubQuery subQueryBuilder, AnalysisMode analysisMode, LuceneFunction luceneFunction,
BooleanQuery booleanQuery, Locale locale, String textFieldName, IndexTokenisationMode tokenisationMode, IndexTokenisationMode preferredTokenisationMode)
throws ParseException
{
FieldInstance fieldInstance = getFieldInstance(textFieldName, pDef, locale, preferredTokenisationMode);
StringBuilder builder = new StringBuilder(queryText.length() + 10);
if(fieldInstance.isLocalised())
{
builder.append("\u0000").append(locale.toString()).append("\u0000");
}
builder.append(queryText);
Query subQuery = subQueryBuilder.getQuery(fieldInstance.getField(), builder.toString(), analysisMode,
luceneFunction);
if (subQuery != null)
{
booleanQuery.add(subQuery, Occur.SHOULD);
}
}
示例9: getRangeQuery
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
/**
* @param field
* @param part1
* @param part2
* @param minInclusive
* @param maxInclusive
* @return
*/
public Query getRangeQuery(SchemaField field, String part1, String part2, boolean minInclusive, boolean maxInclusive)
{
SolrLuceneAnalyser defaultAnalyser = new SolrLuceneAnalyser(getDictionaryService(CMISStrictDictionaryService.DEFAULT), getMLAnalysisMode(), alfrescoDataType.getDefaultAnalyzer(), this);
SolrQueryParser parser = new SolrQueryParser("TEXT", defaultAnalyser);
parser.setDefaultOperator(Operator.AND);
parser.setNamespacePrefixResolver(namespaceDAO);
parser.setDictionaryService(getDictionaryService(CMISStrictDictionaryService.DEFAULT));
parser.setTenantService(tenantService);
parser.setSearchParameters(null);
parser.setDefaultSearchMLAnalysisMode(getMLAnalysisMode());
parser.setIndexReader(null);
parser.setAllowLeadingWildcard(true);
try
{
return parser.getRangeQuery(field.getName(), part1, part2, minInclusive, maxInclusive, AnalysisMode.DEFAULT, LuceneFunction.FIELD);
}
catch (ParseException e)
{
throw new AlfrescoRuntimeException("Parse error building range query", e);
}
}
示例10: addLocaleSpecificTextRange
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
private void addLocaleSpecificTextRange(String expandedFieldName, String part1, String part2, boolean includeLower, boolean includeUpper, BooleanQuery booleanQuery,
Locale locale, AnalysisMode analysisMode, IndexTokenisationMode tokenisationMode, IndexTokenisationMode preferredtokenisationMode) throws ParseException
{
String field = getFieldName(expandedFieldName, locale, tokenisationMode, preferredtokenisationMode);
StringBuilder builder = new StringBuilder();
builder.append("\u0000").append(locale.toString()).append("\u0000").append(part1);
String first = getToken(field, builder.toString(), analysisMode);
if ((first == null) && (false == field.endsWith(".u")))
{
first = getToken(field + ".u", builder.toString(), analysisMode);
}
builder = new StringBuilder();
builder.append("\u0000").append(locale.toString()).append("\u0000").append(part2);
String last = getToken(field, builder.toString(), analysisMode);
if ((last == null) && (false == field.endsWith(".u")))
{
last = getToken(field + ".u", builder.toString(), analysisMode);
}
Query query = new TermRangeQuery(field, first, last, includeLower, includeUpper);
booleanQuery.add(query, Occur.SHOULD);
}
示例11: addLocaleSpecificUntokenisedMLOrTextAttribute
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的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);
}
}
示例12: getDoesNotMatchFieldQuery
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
/**
* @param field String
* @param queryText String
* @param analysisMode AnalysisMode
* @param luceneFunction LuceneFunction
* @return the query
* @throws ParseException
*/
public Query getDoesNotMatchFieldQuery(String field, String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException
{
BooleanQuery query = new BooleanQuery();
Query allQuery = new MatchAllDocsQuery();
Query matchQuery = getFieldQuery(field, queryText, analysisMode, luceneFunction);
if ((matchQuery != null))
{
query.add(allQuery, Occur.MUST);
query.add(matchQuery, Occur.MUST_NOT);
}
else
{
throw new UnsupportedOperationException();
}
return query;
}
示例13: createDataTypeDefinitionQuery
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
protected Query createDataTypeDefinitionQuery(String field, String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException
{
Collection<QName> contentAttributes = dictionaryService.getAllProperties(matchDataTypeDefinition(field).getName());
BooleanQuery query = new BooleanQuery();
for (QName qname : contentAttributes)
{
// The super implementation will create phrase queries etc if required
Query part = getFieldQuery(PROPERTY_FIELD_PREFIX + qname.toString(), queryText, analysisMode, luceneFunction);
if (part != null)
{
query.add(part, Occur.SHOULD);
}
else
{
query.add(createNoMatchQuery(), Occur.SHOULD);
}
}
return query;
}
示例14: createIsNotNull
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
protected Query createIsNotNull(String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException
{
PropertyDefinition pd = matchPropertyDefinition(queryText);
if (pd != null)
{
ClassDefinition containerClass = pd.getContainerClass();
QName container = containerClass.getName();
BooleanQuery query = new BooleanQuery();
String classType = containerClass.isAspect() ? FIELD_ASPECT : FIELD_TYPE;
Query typeQuery = getFieldQuery(classType, container.toString(), analysisMode, luceneFunction);
Query presenceQuery = getWildcardQuery(PROPERTY_FIELD_PREFIX + pd.getName().toString(), "*");
if ((typeQuery != null) && (presenceQuery != null))
{
// query.add(typeQuery, Occur.MUST);
query.add(presenceQuery, Occur.MUST);
}
return query;
}
else
{
return getFieldQueryImpl(FIELD_ISNOTNULL, queryText, analysisMode, luceneFunction);
}
}
示例15: createIsNullQuery
import org.alfresco.repo.search.adaptor.lucene.AnalysisMode; //导入依赖的package包/类
protected Query createIsNullQuery(String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException
{
PropertyDefinition pd = matchPropertyDefinition(queryText);
if (pd != null)
{
BooleanQuery query = new BooleanQuery();
Query presenceQuery = getWildcardQuery(PROPERTY_FIELD_PREFIX + pd.getName().toString(), "*");
if (presenceQuery != null)
{
query.add(new MatchAllDocsQuery(), Occur.MUST);
query.add(presenceQuery, Occur.MUST_NOT);
}
return query;
}
else
{
return getFieldQueryImpl(FIELD_ISNULL, queryText, analysisMode, luceneFunction);
}
}