本文整理汇总了Java中org.alfresco.repo.search.impl.QueryParserUtils类的典型用法代码示例。如果您正苦于以下问题:Java QueryParserUtils类的具体用法?Java QueryParserUtils怎么用?Java QueryParserUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QueryParserUtils类属于org.alfresco.repo.search.impl包,在下文中一共展示了QueryParserUtils类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataTypeDefinitionQuery
import org.alfresco.repo.search.impl.QueryParserUtils; //导入依赖的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;
}
示例2: createExistsQuery
import org.alfresco.repo.search.impl.QueryParserUtils; //导入依赖的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;
}
}
示例3: getNodes
import org.alfresco.repo.search.impl.QueryParserUtils; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void getNodes(NodeParameters nodeParameters, NodeQueryCallback callback)
{
if(enabled)
{
QName shardPropertQName = null;
if(nodeParameters.getShardProperty() != null)
{
PropertyDefinition pdef = QueryParserUtils.matchPropertyDefinition(NamespaceService.CONTENT_MODEL_1_0_URI, namespaceService, dictionaryService, nodeParameters.getShardProperty());
if(pdef == null)
{
throw new AlfrescoRuntimeException("Invalid shard property: "+nodeParameters.getShardProperty());
}
if((!pdef.getDataType().getName().equals(DataTypeDefinition.TEXT)) && (!pdef.getDataType().getName().equals(DataTypeDefinition.DATE)) && (!pdef.getDataType().getName().equals(DataTypeDefinition.DATETIME)))
{
throw new AlfrescoRuntimeException("Unsupported shard property type: "+(pdef.getDataType().getName() + " for " +nodeParameters.getShardProperty()));
}
shardPropertQName = pdef.getName();
}
List<Node> nodes = solrDAO.getNodes(nodeParameters, shardPropertQName);
for (Node node : nodes)
{
callback.handleNode(node);
}
}
}
示例4: isPropertyField
import org.alfresco.repo.search.impl.QueryParserUtils; //导入依赖的package包/类
private boolean isPropertyField(String field)
{
if(field.startsWith(PROPERTY_FIELD_PREFIX))
{
return true;
}
int index = field.lastIndexOf('@');
if(index > -1)
{
PropertyDefinition pDef = QueryParserUtils.matchPropertyDefinition(searchParameters.getNamespace(), namespacePrefixResolver, dictionaryService, field.substring(index+1));
if(pDef != null)
{
IndexedField indexedField = AlfrescoSolrDataModel.getInstance().getIndexedFieldNamesForProperty(pDef.getName());
for(FieldInstance instance : indexedField.getFields())
{
if(instance.getField().equals(field))
{
return true;
}
}
return false;
}
else
{
return false;
}
}
else
{
return false;
}
}
示例5: matchDataTypeDefinition
import org.alfresco.repo.search.impl.QueryParserUtils; //导入依赖的package包/类
private DataTypeDefinition matchDataTypeDefinition(String string)
{
QName search = QName.createQName(QueryParserUtils.expandQName(searchParameters.getNamespace(), namespacePrefixResolver, string));
DataTypeDefinition dataTypeDefinition = dictionaryService.getDataType(QName.createQName(QueryParserUtils.expandQName(searchParameters.getNamespace(), namespacePrefixResolver, string)));
QName match = null;
if (dataTypeDefinition == null)
{
for (QName definition : dictionaryService.getAllDataTypes())
{
if (definition.getNamespaceURI().equalsIgnoreCase(search.getNamespaceURI()))
{
if (definition.getLocalName().equalsIgnoreCase(search.getLocalName()))
{
if (match == null)
{
match = definition;
}
else
{
throw new LuceneQueryParserException("Ambiguous data datype " + string);
}
}
}
}
}
else
{
return dataTypeDefinition;
}
if (match == null)
{
return null;
}
else
{
return dictionaryService.getDataType(match);
}
}
示例6: matchPropertyDefinition
import org.alfresco.repo.search.impl.QueryParserUtils; //导入依赖的package包/类
private PropertyDefinition matchPropertyDefinition(String string)
{
QName search = QName.createQName(QueryParserUtils.expandQName(searchParameters.getNamespace(), namespacePrefixResolver, string));
PropertyDefinition propertyDefinition = dictionaryService.getProperty(QName.createQName(QueryParserUtils.expandQName(searchParameters.getNamespace(), namespacePrefixResolver, string)));
QName match = null;
if (propertyDefinition == null)
{
for (QName definition : dictionaryService.getAllProperties(null))
{
if (definition.getNamespaceURI().equalsIgnoreCase(search.getNamespaceURI()))
{
if (definition.getLocalName().equalsIgnoreCase(search.getLocalName()))
{
if (match == null)
{
match = definition;
}
else
{
throw new LuceneQueryParserException("Ambiguous data datype " + string);
}
}
}
}
}
else
{
return propertyDefinition;
}
if (match == null)
{
return null;
}
else
{
return dictionaryService.getProperty(match);
}
}
示例7: mapProperty
import org.alfresco.repo.search.impl.QueryParserUtils; //导入依赖的package包/类
/**
*
* @param potentialProperty String
* @param fieldUse FieldUse
* @param req SolrQueryRequest
* @return String
*/
public String mapProperty(String potentialProperty, FieldUse fieldUse, SolrQueryRequest req)
{
if(potentialProperty.equals("asc") || potentialProperty.equals("desc") || potentialProperty.equals("_docid_"))
{
return potentialProperty;
}
if(potentialProperty.equalsIgnoreCase("score") || potentialProperty.equalsIgnoreCase("SEARCH_SCORE"))
{
return "score";
}
if(req.getSchema().getFieldOrNull(potentialProperty) != null)
{
return mapNonPropertyFields(potentialProperty);
}
AlfrescoFunctionEvaluationContext functionContext = new AlfrescoSolr4FunctionEvaluationContext(getNamespaceDAO(), getDictionaryService(CMISStrictDictionaryService.DEFAULT), NamespaceService.CONTENT_MODEL_1_0_URI, req.getSchema());
Pair<String, String> fieldNameAndEnding = QueryParserUtils.extractFieldNameAndEnding(potentialProperty);
String luceneField = functionContext.getLuceneFieldName(fieldNameAndEnding.getFirst());
PropertyDefinition propertyDef = QueryParserUtils.matchPropertyDefinition(NamespaceService.CONTENT_MODEL_1_0_URI, getNamespaceDAO(), getDictionaryService(CMISStrictDictionaryService.DEFAULT), fieldNameAndEnding.getFirst());
String solrSortField = null;
if(propertyDef != null)
{
IndexedField fields = AlfrescoSolrDataModel.getInstance().getQueryableFields(propertyDef.getName(), getTextField(fieldNameAndEnding.getSecond()), fieldUse);
if(fields.getFields().size() > 0)
{
solrSortField = fields.getFields().get(0).getField();
}
else
{
solrSortField = mapNonPropertyFields(luceneField);
}
}
else
{
solrSortField = mapNonPropertyFields(luceneField);
}
return solrSortField;
}
示例8: expandAttributeFieldName
import org.alfresco.repo.search.impl.QueryParserUtils; //导入依赖的package包/类
private String expandAttributeFieldName(String field)
{
return PROPERTY_FIELD_PREFIX + QueryParserUtils.expandQName(searchParameters.getNamespace(), namespacePrefixResolver, field.substring(1));
}
示例9: expandAttributeFieldName
import org.alfresco.repo.search.impl.QueryParserUtils; //导入依赖的package包/类
private String expandAttributeFieldName(String field)
{
return PROPERTY_FIELD_PREFIX + QueryParserUtils.expandQName(searchParameters.getNamespace(), namespacePrefixResolver, field.substring(1));
}