当前位置: 首页>>代码示例>>Java>>正文


Java IndexableBinaryStringTools.getEncodedLength方法代码示例

本文整理汇总了Java中org.apache.lucene.util.IndexableBinaryStringTools.getEncodedLength方法的典型用法代码示例。如果您正苦于以下问题:Java IndexableBinaryStringTools.getEncodedLength方法的具体用法?Java IndexableBinaryStringTools.getEncodedLength怎么用?Java IndexableBinaryStringTools.getEncodedLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.util.IndexableBinaryStringTools的用法示例。


在下文中一共展示了IndexableBinaryStringTools.getEncodedLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: incrementToken

import org.apache.lucene.util.IndexableBinaryStringTools; //导入方法依赖的package包/类
@Override
public boolean incrementToken() throws IOException {
  if (input.incrementToken()) {
    char[] termBuffer = termAtt.buffer();
    String termText = new String(termBuffer, 0, termAtt.length());
    collator.getRawCollationKey(termText, reusableKey);
    int encodedLength = IndexableBinaryStringTools.getEncodedLength(
        reusableKey.bytes, 0, reusableKey.size);
    if (encodedLength > termBuffer.length) {
      termAtt.resizeBuffer(encodedLength);
    }
    termAtt.setLength(encodedLength);
    IndexableBinaryStringTools.encode(reusableKey.bytes, 0, reusableKey.size,
        termAtt.buffer(), 0, encodedLength);
    return true;
  } else {
    return false;
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:ICUCollationKeyFilter.java

示例2: incrementToken

import org.apache.lucene.util.IndexableBinaryStringTools; //导入方法依赖的package包/类
@Override
public boolean incrementToken() throws IOException {
  if (input.incrementToken()) {
    byte[] collationKey = collator.getCollationKey(termAtt.toString()).toByteArray();
    int encodedLength = IndexableBinaryStringTools.getEncodedLength(
        collationKey, 0, collationKey.length);
    termAtt.resizeBuffer(encodedLength);
    termAtt.setLength(encodedLength);
    IndexableBinaryStringTools.encode(collationKey, 0, collationKey.length,
        termAtt.buffer(), 0, encodedLength);
    return true;
  } else {
    return false;
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:CollationKeyFilter.java

示例3: encodeCollationKey

import org.apache.lucene.util.IndexableBinaryStringTools; //导入方法依赖的package包/类
/**
 * Convenience method to perform the same function as CollationKeyFilter.
 *  
 * @param keyBits the result from 
 *  collator.getCollationKey(original).toByteArray()
 * @return The encoded collation key for the original String
 * @deprecated only for testing deprecated filters
 */
@Deprecated
protected String encodeCollationKey(byte[] keyBits) {
  // Ensure that the backing char[] array is large enough to hold the encoded
  // Binary String
  int encodedLength = IndexableBinaryStringTools.getEncodedLength(keyBits, 0, keyBits.length);
  char[] encodedBegArray = new char[encodedLength];
  IndexableBinaryStringTools.encode(keyBits, 0, keyBits.length, encodedBegArray, 0, encodedLength);
  return new String(encodedBegArray);
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:CollationTestBase.java


注:本文中的org.apache.lucene.util.IndexableBinaryStringTools.getEncodedLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。