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