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

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

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

Token.setTermBuffer介绍

[英]Copies the contents of buffer into the termBuffer array.
[中]将缓冲区的内容复制到termBuffer数组中。

代码示例

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /**
  2. * Fills Lucene token with the current token text.
  3. */
  4. final void getText(Token t) {
  5. t.setTermBuffer(zzBuffer, zzStartRead, zzMarkedPos-zzStartRead);
  6. }

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

  1. /**
  2. * Fills Lucene token with the current token text.
  3. */
  4. final void getText(Token t) {
  5. t.setTermBuffer(zzBuffer, zzStartRead, zzMarkedPos-zzStartRead);
  6. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /**
  2. * Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.
  3. * @param prototype
  4. * @param newTerm
  5. */
  6. public void reinit(Token prototype, String newTerm) {
  7. setTermBuffer(newTerm);
  8. positionIncrement = prototype.positionIncrement;
  9. flags = prototype.flags;
  10. startOffset = prototype.startOffset;
  11. endOffset = prototype.endOffset;
  12. type = prototype.type;
  13. payload = prototype.payload;
  14. }

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

  1. /**
  2. * Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.
  3. * @param prototype
  4. * @param newTerm
  5. */
  6. public void reinit(Token prototype, String newTerm) {
  7. setTermBuffer(newTerm);
  8. positionIncrement = prototype.positionIncrement;
  9. flags = prototype.flags;
  10. startOffset = prototype.startOffset;
  11. endOffset = prototype.endOffset;
  12. type = prototype.type;
  13. payload = prototype.payload;
  14. }

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

  1. /**
  2. * Constructs a Token with the given term buffer (offset
  3. * & length), start and end
  4. * offsets
  5. * @param startTermBuffer
  6. * @param termBufferOffset
  7. * @param termBufferLength
  8. * @param start
  9. * @param end
  10. */
  11. public Token(char[] startTermBuffer, int termBufferOffset, int termBufferLength, int start, int end) {
  12. setTermBuffer(startTermBuffer, termBufferOffset, termBufferLength);
  13. startOffset = start;
  14. endOffset = end;
  15. }

代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core

  1. /** Produces a List<Token> from a List<String> */
  2. public static List<Token> makeTokens(List<String> strings) {
  3. List<Token> ret = new ArrayList<Token>(strings.size());
  4. for (String str : strings) {
  5. //Token newTok = new Token(str,0,0,"SYNONYM");
  6. Token newTok = new Token(0,0,"SYNONYM");
  7. newTok.setTermBuffer(str.toCharArray(), 0, str.length());
  8. ret.add(newTok);
  9. }
  10. return ret;
  11. }

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

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(String)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset}
  5. * {@link #setType}
  6. * @return this Token instance */
  7. public Token reinit(String newTerm, int newStartOffset, int newEndOffset, String newType) {
  8. clearNoTermBuffer();
  9. setTermBuffer(newTerm);
  10. startOffset = newStartOffset;
  11. endOffset = newEndOffset;
  12. type = newType;
  13. return this;
  14. }

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

  1. /**
  2. * Copy the prototype token's fields into this one. Note: Payloads are shared.
  3. * @param prototype
  4. */
  5. public void reinit(Token prototype) {
  6. prototype.initTermBuffer();
  7. setTermBuffer(prototype.termBuffer, 0, prototype.termLength);
  8. positionIncrement = prototype.positionIncrement;
  9. flags = prototype.flags;
  10. startOffset = prototype.startOffset;
  11. endOffset = prototype.endOffset;
  12. type = prototype.type;
  13. payload = prototype.payload;
  14. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(String)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset}
  5. * {@link #setType}
  6. * @return this Token instance */
  7. public Token reinit(String newTerm, int newStartOffset, int newEndOffset, String newType) {
  8. clearNoTermBuffer();
  9. setTermBuffer(newTerm);
  10. startOffset = newStartOffset;
  11. endOffset = newEndOffset;
  12. type = newType;
  13. return this;
  14. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(String, int, int)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset}
  5. * {@link #setType}
  6. * @return this Token instance */
  7. public Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
  8. clearNoTermBuffer();
  9. setTermBuffer(newTerm, newTermOffset, newTermLength);
  10. startOffset = newStartOffset;
  11. endOffset = newEndOffset;
  12. type = newType;
  13. return this;
  14. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(String)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset}
  5. * {@link #setType} on Token.DEFAULT_TYPE
  6. * @return this Token instance */
  7. public Token reinit(String newTerm, int newStartOffset, int newEndOffset) {
  8. clearNoTermBuffer();
  9. setTermBuffer(newTerm);
  10. startOffset = newStartOffset;
  11. endOffset = newEndOffset;
  12. type = DEFAULT_TYPE;
  13. return this;
  14. }

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

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(String, int, int)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset}
  5. * {@link #setType}
  6. * @return this Token instance */
  7. public Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
  8. clearNoTermBuffer();
  9. setTermBuffer(newTerm, newTermOffset, newTermLength);
  10. startOffset = newStartOffset;
  11. endOffset = newEndOffset;
  12. type = newType;
  13. return this;
  14. }

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

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(String)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset}
  5. * {@link #setType} on Token.DEFAULT_TYPE
  6. * @return this Token instance */
  7. public Token reinit(String newTerm, int newStartOffset, int newEndOffset) {
  8. clearNoTermBuffer();
  9. setTermBuffer(newTerm);
  10. startOffset = newStartOffset;
  11. endOffset = newEndOffset;
  12. type = DEFAULT_TYPE;
  13. return this;
  14. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(char[], int, int)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset},
  5. * {@link #setType}
  6. * @return this Token instance */
  7. public Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
  8. clearNoTermBuffer();
  9. payload = null;
  10. positionIncrement = 1;
  11. setTermBuffer(newTermBuffer, newTermOffset, newTermLength);
  12. startOffset = newStartOffset;
  13. endOffset = newEndOffset;
  14. type = newType;
  15. return this;
  16. }

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

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(char[], int, int)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset},
  5. * {@link #setType}
  6. * @return this Token instance */
  7. public Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
  8. clearNoTermBuffer();
  9. payload = null;
  10. positionIncrement = 1;
  11. setTermBuffer(newTermBuffer, newTermOffset, newTermLength);
  12. startOffset = newStartOffset;
  13. endOffset = newEndOffset;
  14. type = newType;
  15. return this;
  16. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(char[], int, int)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset}
  5. * {@link #setType} on Token.DEFAULT_TYPE
  6. * @return this Token instance */
  7. public Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) {
  8. clearNoTermBuffer();
  9. setTermBuffer(newTermBuffer, newTermOffset, newTermLength);
  10. startOffset = newStartOffset;
  11. endOffset = newEndOffset;
  12. type = DEFAULT_TYPE;
  13. return this;
  14. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /** Shorthand for calling {@link #clear},
  2. * {@link #setTermBuffer(String, int, int)},
  3. * {@link #setStartOffset},
  4. * {@link #setEndOffset}
  5. * {@link #setType} on Token.DEFAULT_TYPE
  6. * @return this Token instance */
  7. public Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) {
  8. clearNoTermBuffer();
  9. setTermBuffer(newTerm, newTermOffset, newTermLength);
  10. startOffset = newStartOffset;
  11. endOffset = newEndOffset;
  12. type = DEFAULT_TYPE;
  13. return this;
  14. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. /**
  2. * Copy the prototype token's fields into this one. Note: Payloads are shared.
  3. * @param prototype
  4. */
  5. public void reinit(Token prototype) {
  6. prototype.initTermBuffer();
  7. setTermBuffer(prototype.termBuffer, 0, prototype.termLength);
  8. positionIncrement = prototype.positionIncrement;
  9. flags = prototype.flags;
  10. startOffset = prototype.startOffset;
  11. endOffset = prototype.endOffset;
  12. type = prototype.type;
  13. payload = prototype.payload;
  14. }

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

  1. public final Token next(final Token reusableToken) throws IOException {
  2. assert reusableToken != null;
  3. Token nextToken = input.next(reusableToken);
  4. if (nextToken == null)
  5. return null;
  6. if (stemmer.stem(nextToken.termBuffer(), 0, nextToken.termLength()))
  7. nextToken.setTermBuffer(stemmer.getResultBuffer(), 0, stemmer.getResultLength());
  8. return nextToken;
  9. }
  10. }

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

  1. public final Token next(final Token reusableToken) throws IOException {
  2. assert reusableToken != null;
  3. Token nextToken = input.next(reusableToken);
  4. if (nextToken == null)
  5. return null;
  6. if (stemmer.stem(nextToken.termBuffer(), 0, nextToken.termLength()))
  7. nextToken.setTermBuffer(stemmer.getResultBuffer(), 0, stemmer.getResultLength());
  8. return nextToken;
  9. }
  10. }

相关文章