本文整理汇总了Java中org.apache.lucene.util.AttributeSource.State类的典型用法代码示例。如果您正苦于以下问题:Java State类的具体用法?Java State怎么用?Java State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
State类属于org.apache.lucene.util.AttributeSource包,在下文中一共展示了State类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: incrementToken
import org.apache.lucene.util.AttributeSource.State; //导入依赖的package包/类
@Override
public final boolean incrementToken() {
// lazy init the iterator
if (it == null) {
it = cachedStates.iterator();
}
if (!it.hasNext()) {
return false;
}
AttributeSource.State state = (State) it.next();
restoreState(state.clone());
return true;
}
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:PreAnalyzedField.java
示例2: BufferedOutputToken
import org.apache.lucene.util.AttributeSource.State; //导入依赖的package包/类
public BufferedOutputToken(State state, String term, int startNode, int endNode) {
this.state = state;
this.term = term;
this.startNode = startNode;
this.endNode = endNode;
}
开发者ID:hailin0,项目名称:elasticsearch-analysis-dynamic-synonym,代码行数:7,代码来源:DynamicSynonymGraphFilter.java
示例3: createState
import org.apache.lucene.util.AttributeSource.State; //导入依赖的package包/类
private static AttributeSource.State createState(AttributeSource a, Tok state, int tokenEnd) {
a.clearAttributes();
CharTermAttribute termAtt = a.addAttribute(CharTermAttribute.class);
char[] tokChars = state.token.toString().toCharArray();
termAtt.copyBuffer(tokChars, 0, tokChars.length);
int tokenStart = tokenEnd - state.token.length();
for (Entry<String, String> e : state.attr.entrySet()) {
String k = e.getKey();
if (k.equals("i")) {
// position increment
int incr = Integer.parseInt(e.getValue());
PositionIncrementAttribute posIncr = a.addAttribute(PositionIncrementAttribute.class);
posIncr.setPositionIncrement(incr);
} else if (k.equals("s")) {
tokenStart = Integer.parseInt(e.getValue());
} else if (k.equals("e")) {
tokenEnd = Integer.parseInt(e.getValue());
} else if (k.equals("y")) {
TypeAttribute type = a.addAttribute(TypeAttribute.class);
type.setType(e.getValue());
} else if (k.equals("f")) {
FlagsAttribute flags = a.addAttribute(FlagsAttribute.class);
int f = Integer.parseInt(e.getValue(), 16);
flags.setFlags(f);
} else if (k.equals("p")) {
PayloadAttribute p = a.addAttribute(PayloadAttribute.class);
byte[] data = hexToBytes(e.getValue());
if (data != null && data.length > 0) {
p.setPayload(new BytesRef(data));
}
} else {
// unknown attribute
}
}
// handle offset attr
OffsetAttribute offset = a.addAttribute(OffsetAttribute.class);
offset.setOffset(tokenStart, tokenEnd);
State resState = a.captureState();
a.clearAttributes();
return resState;
}
开发者ID:europeana,项目名称:search,代码行数:42,代码来源:SimplePreAnalyzedParser.java
注:本文中的org.apache.lucene.util.AttributeSource.State类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论