Package org.apache.lucene.sandbox.queries.regex

Examples of org.apache.lucene.sandbox.queries.regex.RegexQuery


    }
  }

  private RegexQuery getFallbackRegexQuery(String str) {
    // No lowercase of str, so '\p{Punct}' doesn't become '\p{punct}':
    final RegexQuery query = new RegexQuery(new Term(FIELD_NAME_LOWERCASE, str));
    query.setRegexImplementation(new JavaUtilRegexCapabilities(JavaUtilRegexCapabilities.FLAG_CASE_INSENSITIVE));
    return query;
  }
View Full Code Here


    if(regexQueryString != null && regexQueryString.length() > 0) {
      List<QueryAnalysisResult> regexQueryAnalysisResultList = getQueryAnalysisResults(regexQueryString);
     
      for(QueryAnalysisResult queryAnalysisResult : regexQueryAnalysisResultList) {
        Term term = new Term(queryAnalysisResult.getFieldName(), queryAnalysisResult.getUserQuery());
        Query regexQuery = new RegexQuery(term);
       
        logger.info("Regex Query : {}", regexQuery);
       
        resultQuery.add(regexQuery, queryAnalysisResult.getOccur());
      }
View Full Code Here

  }

  /** Return a query with the old (and slow, but more complete) way Lucene implements regular expressions. */
  private RegexQuery getFallbackRegexQuery(String str, Element element) {
    // No lowercase of str, so '\p{Punct}' doesn't become '\p{punct}':
    final RegexQuery query = new RegexQuery(new Term(element.isCaseSensitive() ? FIELD_NAME : FIELD_NAME_LOWERCASE, str));
    query.setRegexImplementation(new JavaUtilRegexCapabilities(JavaUtilRegexCapabilities.FLAG_CASE_INSENSITIVE));
    return query;
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.sandbox.queries.regex.RegexQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.