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


Java ParseException.getMessage方法代碼示例

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


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

示例1: getQuery

import org.apache.lucene.queryparser.classic.ParseException; //導入方法依賴的package包/類
@Override
public Query getQuery(Element e) throws ParserException {
  String text = DOMUtils.getText(e);
  try {
    Query q = null;
    if (unSafeParser != null) {
      //synchronize on unsafe parser
      synchronized (unSafeParser) {
        q = unSafeParser.parse(text);
      }
    } else {
      String fieldName = DOMUtils.getAttribute(e, "fieldName", defaultField);
      //Create new parser
      QueryParser parser = createQueryParser(fieldName, analyzer);
      q = parser.parse(text);
    }
    q.setBoost(DOMUtils.getAttribute(e, "boost", 1.0f));
    return q;
  } catch (ParseException e1) {
    throw new ParserException(e1.getMessage());
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:UserInputQueryBuilder.java

示例2: transform

import org.apache.lucene.queryparser.classic.ParseException; //導入方法依賴的package包/類
@Override
public org.apache.lucene.search.Query transform(final Query input) throws QueryTransformException {
    try {
        org.apache.lucene.search.Query luceneQuery = new QueryParser(defaultField, analyzer).parse(input.getQuery());

        if (input.getFilterQueries() == null || facetsConfig == null) {
            return luceneQuery;
        }

        // wrap the original query in a DrillDownQuery
        DrillDownQuery drillDownQuery = new DrillDownQuery(facetsConfig, luceneQuery);

        // add all the filter queries to the DrillDownQuery
        input.getFilterQueries().stream().forEach(fq -> drillDownQuery.add(fq.getField().getName(), fq.getValue()));
        return drillDownQuery;

    } catch (ParseException e) {
        throw new QueryTransformException(e.getMessage(), e);
    }
}
 
開發者ID:bbende,項目名稱:tripod,代碼行數:21,代碼來源:StandardLuceneQueryTransformer.java

示例3: create

import org.apache.lucene.queryparser.classic.ParseException; //導入方法依賴的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: createQuery

import org.apache.lucene.queryparser.classic.ParseException; //導入方法依賴的package包/類
private Query createQuery(final String query) {
    Query result = null;
    try {
        result = queryParser.parse(query);
    } catch (ParseException e) {
        throw new QueryCannotBeParsedException("Query " + query + "cannot be parsed. Reason:" + e.getMessage());
    }
    return result;
}
 
開發者ID:epam,項目名稱:Wilma,代碼行數:10,代碼來源:LuceneSearchEngine.java


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