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


Java QueryParserUtils类代码示例

本文整理汇总了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;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:20,代码来源:Solr4QueryParser.java

示例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;
	}
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:21,代码来源:Solr4QueryParser.java

示例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);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:SOLRTrackingComponentImpl.java

示例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;
	}

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

示例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);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:40,代码来源:AbstractLuceneQueryParser.java

示例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);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:40,代码来源:AbstractLuceneQueryParser.java

示例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;
  
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:54,代码来源:AlfrescoSolrDataModel.java

示例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));
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:5,代码来源:Solr4QueryParser.java

示例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));
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:5,代码来源:AbstractLuceneQueryParser.java


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