org.apache.lucene.analysis.Token.buffer()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(171)

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

Token.buffer介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-search

public static String getTermText(Token token) {
    return new String( token.buffer(), 0, token.length() );
  }
}

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

public static String getTermText(Token token) {
    return new String( token.buffer(), 0, token.length() );
  }
}

代码示例来源:origin: gncloud/fastcatsearch

/**
 * Copy the prototype token's fields into this one. Note: Payloads are shared.
 * @param prototype source Token to copy fields from
 */
public void reinit(Token prototype) {
 copyBuffer(prototype.buffer(), 0, prototype.length());
 positionIncrement = prototype.positionIncrement;
 flags = prototype.flags;
 startOffset = prototype.startOffset;
 endOffset = prototype.endOffset;
 type = prototype.type;
 payload =  prototype.payload;
}

代码示例来源:origin: DiceTechJobs/SolrPlugins

private List<LookupResult> getLookupResults(SpellingOptions options, Token currentToken) throws IOException {
  CharsRef scratch = new CharsRef();
  scratch.chars = currentToken.buffer();
  scratch.offset = 0;
  scratch.length = currentToken.length();
  boolean onlyMorePopular = (options.suggestMode == SuggestMode.SUGGEST_MORE_POPULAR) &&
      !(lookup instanceof WFSTCompletionLookup) &&
      !(lookup instanceof AnalyzingSuggester);
  List<LookupResult> suggestions = lookup.lookup(scratch, onlyMorePopular, options.count);
  if (suggestions == null || suggestions.size() == 0) {
    return null;
  }
  return suggestions;
}

代码示例来源:origin: DiceTechJobs/SolrPlugins

scratch.chars = currentToken.buffer();
scratch.offset = 0;
scratch.length = currentToken.length();

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

sb.append(spacerCharacter);
sb.append(shingleToken.buffer(), 0, shingleToken.length());

代码示例来源:origin: DiceTechJobs/SolrPlugins

.entrySet()) {
Token inputToken = entry.getKey();
String tokenString = new String(inputToken.buffer(), 0, inputToken
    .length());
Map<String,Integer> theSuggestions = new LinkedHashMap<String,Integer>(

代码示例来源:origin: treygrainger/solr-in-action

@Override
public boolean incrementToken() throws IOException {
 if (this.tokens == null) {
  String data = convertReaderToString(this.multiTextInput.Reader);
  if (data.equals("")) {
   return false;
  }
  // get tokens
  this.tokens = mergeToSingleTokenStream(createPositionsToTokensMap(
    this.namedAnalyzers, data));
  if (this.tokens == null) {
   // at end of stream for some reason
   return false;
  }
 }
 if (tokens.isEmpty()) {
  this.tokens = null;
  return false;
 } else {
  clearAttributes();
  Token token = tokens.removeFirst();
  this.charTermAttribute.copyBuffer(token.buffer(), 0, token.length());
  this.offsetAttribute.setOffset(token.startOffset(), token.endOffset()
    + this.startingOffset);
  this.typeAttribute.setType(token.type());
  this.positionAttribute.setPositionIncrement(token.getPositionIncrement());
  return true;
 }
}

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

private void setCurrentToken(Token token) {
 if (token == null) return;
 clearAttributes();
 termAtt.copyBuffer(token.buffer(), 0, token.length());
 posIncrAtt.setPositionIncrement(token.getPositionIncrement());
 flagsAtt.setFlags(token.getFlags());
 offsetAtt.setOffset(token.startOffset(), token.endOffset());
 typeAtt.setType(token.type());
 payloadAtt.setPayload(token.getPayload());
}

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

private void setCurrentToken(Token token) {
 if (token == null) return;
 clearAttributes();
 termAtt.copyBuffer(token.buffer(), 0, token.length());
 posIncrAtt.setPositionIncrement(token.getPositionIncrement());
 flagsAtt.setFlags(token.getFlags());
 offsetAtt.setOffset(token.startOffset(), token.endOffset());
 typeAtt.setType(token.type());
 payloadAtt.setPayload(token.getPayload());
}

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

@Override
public final boolean incrementToken() throws IOException {
 if (matrix == null) {
  matrix = new Matrix();
  // fill matrix with maximumShingleSize columns
  while (matrix.columns.size() < maximumShingleSize && readColumn()) {
   // this loop looks ugly
  }
 }
 // this loop exists in order to avoid recursive calls to the next method
 // as the complexity of a large matrix
 // then would require a multi gigabyte sized stack.
 Token token;
 do {
  token = produceNextToken(reusableToken);
 } while (token == request_next_token);
 if (token == null) return false;
 clearAttributes();
 termAtt.copyBuffer(token.buffer(), 0, token.length());
 posIncrAtt.setPositionIncrement(token.getPositionIncrement());
 flagsAtt.setFlags(token.getFlags());
 offsetAtt.setOffset(token.startOffset(), token.endOffset());
 typeAtt.setType(token.type());
 payloadAtt.setPayload(token.getPayload());
 return true;
}

相关文章