當前位置: 首頁>>代碼示例>>Java>>正文


Java QueryParser.setLowercaseExpandedTerms方法代碼示例

本文整理匯總了Java中org.apache.lucene.queryparser.classic.QueryParser.setLowercaseExpandedTerms方法的典型用法代碼示例。如果您正苦於以下問題:Java QueryParser.setLowercaseExpandedTerms方法的具體用法?Java QueryParser.setLowercaseExpandedTerms怎麽用?Java QueryParser.setLowercaseExpandedTerms使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.lucene.queryparser.classic.QueryParser的用法示例。


在下文中一共展示了QueryParser.setLowercaseExpandedTerms方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: query

import org.apache.lucene.queryparser.classic.QueryParser; //導入方法依賴的package包/類
Query query( String keyOrNull, Object value, QueryContext contextOrNull )
{
    if ( value instanceof Query )
    {
        return (Query) value;
    }

    QueryParser parser = new QueryParser( keyOrNull, analyzer );
    parser.setAllowLeadingWildcard( true );
    parser.setLowercaseExpandedTerms( toLowerCase );
    if ( contextOrNull != null && contextOrNull.getDefaultOperator() != null )
    {
        parser.setDefaultOperator( contextOrNull.getDefaultOperator() );
    }
    try
    {
        return parser.parse( value.toString() );
    }
    catch ( ParseException e )
    {
        throw new RuntimeException( e );
    }
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-lucene5-index,代碼行數:24,代碼來源:IndexType.java

示例2: query

import org.apache.lucene.queryparser.classic.QueryParser; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public Query query(Schema schema) {

    if (query == null) {
        throw new IllegalArgumentException("Query statement required");
    }

    try {
        Analyzer analyzer = schema.getAnalyzer();
        QueryParser queryParser = new QueryParser(defaultField, analyzer);
        queryParser.setAllowLeadingWildcard(true);
        queryParser.setLowercaseExpandedTerms(false);
        Query luceneQuery = queryParser.parse(query);
        luceneQuery.setBoost(boost);
        return luceneQuery;
    } catch (ParseException e) {
        throw new RuntimeException("Error while parsing lucene syntax query", e);
    }
}
 
開發者ID:Stratio,項目名稱:stratio-cassandra,代碼行數:21,代碼來源:LuceneCondition.java

示例3: create

import org.apache.lucene.queryparser.classic.QueryParser; //導入方法依賴的package包/類
private QueryExpression create(Request request, ResourceDefinition resourceDefinition) throws InvalidQueryException {
    String queryString;
    if (request.getCardinality() == Request.Cardinality.INSTANCE) {
        String idPropertyName = resourceDefinition.getIdPropertyName();
        queryString = String.format("%s:%s", idPropertyName, request.<String>getProperty(idPropertyName));
    } else {
        queryString = request.getQueryString();
    }

    QueryExpression queryExpression;
    if (queryString != null && !queryString.isEmpty()) {
        QueryParser queryParser = new QueryParser(Version.LUCENE_48, "name", new KeywordAnalyzer());
        queryParser.setLowercaseExpandedTerms(false);
        queryParser.setAllowLeadingWildcard(true);
        Query query;
        try {
            query = queryParser.parse((String) escape(queryString));
        } catch (ParseException e) {
            throw new InvalidQueryException(e.getMessage());
        }
        LOG.info("LuceneQuery: {}", query);
        queryExpression = create(query, resourceDefinition);
    } else {
        queryExpression = new AlwaysQueryExpression();
    }
    // add query properties to request so that they are returned
    request.addAdditionalSelectProperties(queryExpression.getProperties());
    return queryExpression;
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:30,代碼來源:QueryFactory.java

示例4: buildQueryFromText

import org.apache.lucene.queryparser.classic.QueryParser; //導入方法依賴的package包/類
private static Query buildQueryFromText(String field, IndexSchema schema, String query) {
    QueryParser queryParser = new QueryParser(Version.LUCENE_45, field, schema.getQueryAnalyzer());
    queryParser.setAllowLeadingWildcard(false);
    queryParser.setLowercaseExpandedTerms(false);
    queryParser.setTimeZone(TimeZone.getDefault());
    queryParser.setAnalyzeRangeTerms(true);
    try {
        return queryParser.parse(query);
    } catch (org.apache.lucene.queryparser.classic.ParseException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:terrancesnyder,項目名稱:solr-groupby-component,代碼行數:13,代碼來源:GroupByComponent.java


注:本文中的org.apache.lucene.queryparser.classic.QueryParser.setLowercaseExpandedTerms方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。