Java 类org.apache.lucene.util.automaton.SpecialOperations 实例源码

项目:NYBC    文件:TestReversedWildcardFilterFactory.java   
/** fragile assert: depends on our implementation, but cleanest way to check for now */ 
private boolean wasReversed(SolrQueryParser qp, String query) throws Exception {
  Query q = qp.parse(query);
  if (!(q instanceof AutomatonQuery))
    return false;
  // this is a hack to get the protected Automaton field in AutomatonQuery,
  // may break in later lucene versions - we have no getter... for good reasons.
  final Field automatonField = AutomatonQuery.class.getDeclaredField("automaton");
  automatonField.setAccessible(true);
  Automaton automaton = (Automaton) automatonField.get(q);
  String prefix = SpecialOperations.getCommonPrefix(automaton);
  return prefix.length() > 0 && prefix.charAt(0) == '\u0001';
}
项目:search-core    文件:TestReversedWildcardFilterFactory.java   
/** fragile assert: depends on our implementation, but cleanest way to check for now */ 
private boolean wasReversed(SolrQueryParser qp, String query) throws Exception {
  Query q = qp.parse(query);
  if (!(q instanceof AutomatonQuery))
    return false;
  // this is a hack to get the protected Automaton field in AutomatonQuery,
  // may break in later lucene versions - we have no getter... for good reasons.
  final Field automatonField = AutomatonQuery.class.getDeclaredField("automaton");
  automatonField.setAccessible(true);
  Automaton automaton = (Automaton) automatonField.get(q);
  String prefix = SpecialOperations.getCommonPrefix(automaton);
  return prefix.length() > 0 && prefix.charAt(0) == '\u0001';
}