org.apache.lucene.util.automaton.Operations.getCommonPrefixBytesRef()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.lucene.util.automaton.Operations.getCommonPrefixBytesRef()方法的一些代码示例,展示了Operations.getCommonPrefixBytesRef()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operations.getCommonPrefixBytesRef()方法的具体详情如下:
包路径:org.apache.lucene.util.automaton.Operations
类名称:Operations
方法名:getCommonPrefixBytesRef

Operations.getCommonPrefixBytesRef介绍

[英]Returns the longest BytesRef that is a prefix of all accepted strings and visits each state at most once. The automaton must be deterministic.
[中]返回最长字节引用,它是所有接受字符串的前缀,最多访问一次每个状态。自动机必须是确定性的。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

  1. /**
  2. * Returns the longest BytesRef that is a suffix of all accepted strings.
  3. * Worst case complexity: exponential in number of states (this calls
  4. * determinize).
  5. * @param maxDeterminizedStates maximum number of states determinizing the
  6. * automaton can result in. Set higher to allow more complex queries and
  7. * lower to prevent memory exhaustion.
  8. * @return common suffix, which can be an empty (length 0) BytesRef (never null)
  9. */
  10. public static BytesRef getCommonSuffixBytesRef(Automaton a, int maxDeterminizedStates) {
  11. // reverse the language of the automaton, then reverse its common prefix.
  12. Automaton r = Operations.determinize(reverse(a), maxDeterminizedStates);
  13. BytesRef ref = getCommonPrefixBytesRef(r);
  14. reverseBytes(ref);
  15. return ref;
  16. }

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * Returns the longest BytesRef that is a suffix of all accepted strings.
  3. * Worst case complexity: exponential in number of states (this calls
  4. * determinize).
  5. * @param maxDeterminizedStates maximum number of states determinizing the
  6. * automaton can result in. Set higher to allow more complex queries and
  7. * lower to prevent memory exhaustion.
  8. * @return common suffix, which can be an empty (length 0) BytesRef (never null)
  9. */
  10. public static BytesRef getCommonSuffixBytesRef(Automaton a, int maxDeterminizedStates) {
  11. // reverse the language of the automaton, then reverse its common prefix.
  12. Automaton r = Operations.determinize(reverse(a), maxDeterminizedStates);
  13. BytesRef ref = getCommonPrefixBytesRef(r);
  14. reverseBytes(ref);
  15. return ref;
  16. }

代码示例来源:origin: org.infinispan/infinispan-embedded-query

  1. /**
  2. * Returns the longest BytesRef that is a suffix of all accepted strings.
  3. * Worst case complexity: exponential in number of states (this calls
  4. * determinize).
  5. * @param maxDeterminizedStates maximum number of states determinizing the
  6. * automaton can result in. Set higher to allow more complex queries and
  7. * lower to prevent memory exhaustion.
  8. * @return common suffix, which can be an empty (length 0) BytesRef (never null)
  9. */
  10. public static BytesRef getCommonSuffixBytesRef(Automaton a, int maxDeterminizedStates) {
  11. // reverse the language of the automaton, then reverse its common prefix.
  12. Automaton r = Operations.determinize(reverse(a), maxDeterminizedStates);
  13. BytesRef ref = getCommonPrefixBytesRef(r);
  14. reverseBytes(ref);
  15. return ref;
  16. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

  1. /**
  2. * Returns the longest BytesRef that is a suffix of all accepted strings.
  3. * Worst case complexity: exponential in number of states (this calls
  4. * determinize).
  5. * @param maxDeterminizedStates maximum number of states determinizing the
  6. * automaton can result in. Set higher to allow more complex queries and
  7. * lower to prevent memory exhaustion.
  8. * @return common suffix, which can be an empty (length 0) BytesRef (never null)
  9. */
  10. public static BytesRef getCommonSuffixBytesRef(Automaton a, int maxDeterminizedStates) {
  11. // reverse the language of the automaton, then reverse its common prefix.
  12. Automaton r = Operations.determinize(reverse(a), maxDeterminizedStates);
  13. BytesRef ref = getCommonPrefixBytesRef(r);
  14. reverseBytes(ref);
  15. return ref;
  16. }

相关文章