本文整理汇总了Java中org.alfresco.repo.search.impl.querymodel.Ordering类的典型用法代码示例。如果您正苦于以下问题:Java Ordering类的具体用法?Java Ordering怎么用?Java Ordering使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Ordering类属于org.alfresco.repo.search.impl.querymodel包,在下文中一共展示了Ordering类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BaseQuery
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public BaseQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
this.columns = columns;
this.source = source;
this.constraint = constraint;
this.orderings = orderings;
}
示例2: buildSortDefinitions
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public List<SortDefinition> buildSortDefinitions(Set<String> selectors, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
{
if ((getOrderings() == null) || (getOrderings().size() == 0))
{
return Collections.<SortDefinition>emptyList();
}
ArrayList<SortDefinition> definitions = new ArrayList<SortDefinition>(getOrderings().size());
for (Ordering ordering : getOrderings())
{
if (ordering.getColumn().getFunction().getName().equals(PropertyAccessor.NAME))
{
PropertyArgument property = (PropertyArgument) ordering.getColumn().getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
if (property == null)
{
throw new IllegalStateException();
}
String propertyName = property.getPropertyName();
String fieldName = functionContext.getLuceneFieldName(propertyName);
definitions.add(new SortDefinition(SortType.FIELD, fieldName, ordering.getOrder() == Order.ASCENDING));
}
else if (ordering.getColumn().getFunction().getName().equals(Score.NAME))
{
definitions.add(new SortDefinition(SortType.SCORE, null, ordering.getOrder() == Order.ASCENDING));
}
}
return definitions;
}
示例3: DBQuery
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
/**
* @param source Source
* @param constraint Constraint
*/
public DBQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
super(columns, source, constraint, orderings);
}
示例4: prepare
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
{
selectorGroup = selectors;
if (selectorGroup != null)
{
for (String selector : selectorGroup)
{
Selector current = getSource().getSelector(selector);
if (current instanceof DBQueryBuilderComponent)
{
((DBQueryBuilderComponent) current).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext, supportBooleanFloatAndDouble);
}
else
{
throw new UnsupportedOperationException();
}
}
}
if (getConstraint() != null)
{
if (getConstraint() instanceof DBQueryBuilderComponent)
{
((DBQueryBuilderComponent) getConstraint()).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext, supportBooleanFloatAndDouble);
}
else
{
throw new UnsupportedOperationException();
}
}
if(getOrderings() != null)
{
for(Ordering ordering : getOrderings())
{
if(ordering instanceof DBQueryBuilderComponent)
{
((DBQueryBuilderComponent) ordering).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext, supportBooleanFloatAndDouble);
}
else
{
throw new UnsupportedOperationException();
}
}
}
}
示例5: buildJoins
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public void buildJoins(Map<QName, DBQueryBuilderJoinCommand> singleJoins, List<DBQueryBuilderJoinCommand> multiJoins)
{
if (selectorGroup != null)
{
for (String selector : selectorGroup)
{
Selector current = getSource().getSelector(selector);
if (current instanceof DBQueryBuilderComponent)
{
((DBQueryBuilderComponent) current).buildJoins(singleJoins, multiJoins);
}
else
{
throw new UnsupportedOperationException();
}
}
}
if (getConstraint() != null)
{
if (getConstraint() instanceof DBQueryBuilderComponent)
{
((DBQueryBuilderComponent) getConstraint()).buildJoins(singleJoins, multiJoins);
}
else
{
throw new UnsupportedOperationException();
}
}
if(getOrderings() != null)
{
for(Ordering ordering : getOrderings())
{
if(ordering instanceof DBQueryBuilderComponent)
{
((DBQueryBuilderComponent) ordering).buildJoins(singleJoins, multiJoins);
}
else
{
throw new UnsupportedOperationException();
}
}
}
}
示例6: createQuery
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public Query createQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
return new DBQuery(columns, source, constraint, orderings);
}
示例7: createOrdering
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public Ordering createOrdering(Column column, Order order)
{
return new DBOrdering(column, order);
}
示例8: getOrderings
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public List<Ordering> getOrderings()
{
return orderings;
}
示例9: LuceneQuery
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
/**
* @param source Source
* @param constraint Constraint
*/
public LuceneQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
super(columns, source, constraint, orderings);
}
示例10: createOrdering
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public Ordering createOrdering(Column column, Order order)
{
return new LuceneOrdering(column, order);
}
示例11: createQuery
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public Query createQuery(List<Column> columns, Source source, Constraint constraint, List<Ordering> orderings)
{
return new LuceneQuery<Q, S, E>(columns, source, constraint, orderings);
}
示例12: getFTSQuery
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
/**
* @param req SolrQueryRequest
* @return Query
* @throws ParseException
*/
public Query getFTSQuery(Pair<SearchParameters, Boolean> searchParametersAndFilter, SolrQueryRequest req, FTSQueryParser.RerankPhase rerankPhase) throws ParseException
{
SearchParameters searchParameters = searchParametersAndFilter.getFirst();
Boolean isFilter = searchParametersAndFilter.getSecond();
QueryModelFactory factory = new LuceneQueryModelFactory<Query, Sort, SyntaxError>();
AlfrescoFunctionEvaluationContext functionContext = new AlfrescoSolr4FunctionEvaluationContext(namespaceDAO, getDictionaryService(CMISStrictDictionaryService.DEFAULT), NamespaceService.CONTENT_MODEL_1_0_URI, req.getSchema());
FTSParser.Mode mode;
if (searchParameters.getDefaultFTSOperator() == org.alfresco.service.cmr.search.SearchParameters.Operator.AND)
{
mode = FTSParser.Mode.DEFAULT_CONJUNCTION;
}
else
{
mode = FTSParser.Mode.DEFAULT_DISJUNCTION;
}
Constraint constraint = FTSQueryParser.buildFTS(searchParameters.getQuery(), factory, functionContext, null, null, mode,
searchParameters.getDefaultFTSOperator() == org.alfresco.service.cmr.search.SearchParameters.Operator.OR ? Connective.OR : Connective.AND,
searchParameters.getQueryTemplates(), searchParameters.getDefaultFieldName(), rerankPhase);
org.alfresco.repo.search.impl.querymodel.Query queryModelQuery = factory.createQuery(null, null, constraint, new ArrayList<Ordering>());
@SuppressWarnings("unchecked")
LuceneQueryBuilder<Query, Sort, ParseException> builder = (LuceneQueryBuilder<Query, Sort, ParseException>) queryModelQuery;
LuceneQueryBuilderContext<Query, Sort, ParseException> luceneContext = getLuceneQueryBuilderContext(searchParameters, req, CMISStrictDictionaryService.DEFAULT, rerankPhase);
Set<String> selectorGroup = null;
if (queryModelQuery.getSource() != null)
{
List<Set<String>> selectorGroups = queryModelQuery.getSource().getSelectorGroups(functionContext);
if (selectorGroups.size() == 0)
{
throw new UnsupportedOperationException("No selectors");
}
if (selectorGroups.size() > 1)
{
throw new UnsupportedOperationException("Advanced join is not supported");
}
selectorGroup = selectorGroups.get(0);
}
Query luceneQuery = builder.buildQuery(selectorGroup, luceneContext, functionContext);
// query needs some search parameters fro correct caching ....
ContextAwareQuery contextAwareQuery = new ContextAwareQuery(luceneQuery, Boolean.TRUE.equals(isFilter) ? null : searchParameters);
return contextAwareQuery;
}
示例13: buildSort
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public Sort buildSort(List<Ordering> list, FunctionEvaluationContext functionContext) throws ParseException
{
throw new UnsupportedOperationException();
}
示例14: buildSort
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
@Override
public Sort buildSort(List<Ordering> orderings, FunctionEvaluationContext functionContext) throws ParseException
{
int index = 0;
SortField[] fields = new SortField[orderings.size()];
for (Ordering ordering : orderings)
{
if (ordering.getColumn().getFunction().getName().equals(PropertyAccessor.NAME))
{
PropertyArgument property = (PropertyArgument) ordering.getColumn().getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
if (property == null)
{
throw new IllegalStateException();
}
String propertyName = property.getPropertyName();
String luceneField = functionContext.getLuceneSortField(this, propertyName);
if (luceneField != null)
{
if (LuceneUtils.fieldHasTerm(lqp.getIndexReader(), luceneField))
{
Locale locale = this.getSearchParameters().getSortLocale();
fields[index++] = new SortField(luceneField, locale, (ordering.getOrder() == Order.DESCENDING));
}
else
{
fields[index++] = new SortField(null, SortField.DOC, (ordering.getOrder() == Order.DESCENDING));
}
}
else
{
throw new IllegalStateException();
}
}
else if (ordering.getColumn().getFunction().getName().equals(Score.NAME))
{
fields[index++] = new SortField(null, SortField.SCORE, !(ordering.getOrder() == Order.DESCENDING));
}
else
{
throw new IllegalStateException();
}
}
return new Sort(fields);
}
示例15: getFTSQuery
import org.alfresco.repo.search.impl.querymodel.Ordering; //导入依赖的package包/类
public Query getFTSQuery(Pair<SearchParameters, Boolean> searchParametersAndFilter, IndexReader indexReader) throws ParseException
{
SearchParameters searchParameters = searchParametersAndFilter.getFirst();
Boolean isFilter = searchParametersAndFilter.getSecond();
QueryModelFactory factory = new LuceneQueryModelFactory();
AlfrescoFunctionEvaluationContext functionContext = new AlfrescoFunctionEvaluationContext(namespaceDAO, getDictionaryService(CMISStrictDictionaryService.DEFAULT), NamespaceService.CONTENT_MODEL_1_0_URI);
FTSParser.Mode mode;
if (searchParameters.getDefaultFTSOperator() == org.alfresco.service.cmr.search.SearchParameters.Operator.AND)
{
mode = FTSParser.Mode.DEFAULT_CONJUNCTION;
}
else
{
mode = FTSParser.Mode.DEFAULT_DISJUNCTION;
}
Constraint constraint = FTSQueryParser.buildFTS(searchParameters.getQuery(), factory, functionContext, null, null, mode,
searchParameters.getDefaultFTSOperator() == org.alfresco.service.cmr.search.SearchParameters.Operator.OR ? Connective.OR : Connective.AND,
searchParameters.getQueryTemplates(), searchParameters.getDefaultFieldName(), FTSQueryParser.RerankPhase.SINGLE_PASS);
org.alfresco.repo.search.impl.querymodel.Query queryModelQuery = factory.createQuery(null, null, constraint, new ArrayList<Ordering>());
@SuppressWarnings("unchecked")
LuceneQueryBuilder<Query, Sort, ParseException> builder = (LuceneQueryBuilder<Query, Sort, ParseException>) queryModelQuery;
LuceneQueryBuilderContext<Query, Sort, ParseException> luceneContext = getLuceneQueryBuilderContext(searchParameters, indexReader, CMISStrictDictionaryService.DEFAULT);
Set<String> selectorGroup = null;
if (queryModelQuery.getSource() != null)
{
List<Set<String>> selectorGroups = queryModelQuery.getSource().getSelectorGroups(functionContext);
if (selectorGroups.size() == 0)
{
throw new UnsupportedOperationException("No selectors");
}
if (selectorGroups.size() > 1)
{
throw new UnsupportedOperationException("Advanced join is not supported");
}
selectorGroup = selectorGroups.get(0);
}
Query luceneQuery = builder.buildQuery(selectorGroup, luceneContext, functionContext);
// query needs some search parameters fro correct caching ....
ContextAwareQuery contextAwareQuery = new ContextAwareQuery(luceneQuery, Boolean.TRUE.equals(isFilter) ? null : searchParameters);
return contextAwareQuery;
}