本文整理匯總了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;
}