本文整理了Java中org.apache.lucene.index.TermEnum.term()
方法的一些代码示例,展示了TermEnum.term()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TermEnum.term()
方法的具体详情如下:
包路径:org.apache.lucene.index.TermEnum
类名称:TermEnum
方法名:term
[英]Returns the current Term in the enumeration.
[中]返回枚举中的当前项。
代码示例
代码示例来源:origin: tjake/Solandra
public void seek(TermEnum termEnum) throws IOException
{
if (termEnum instanceof LucandraTermEnum)
{
this.termEnum = (LucandraTermEnum) termEnum;
}
else
{
this.termEnum = (LucandraTermEnum) indexReader.terms(termEnum.term());
}
termDocs = this.termEnum.getTermDocFreq();
if (logger.isDebugEnabled())
logger.debug("seeked out " + termDocs.length);
docPosition = -1;
}
代码示例来源:origin: tjake/Solandra
@Override
protected Object createValue(IndexReader reader, Entry entryKey)
throws IOException {
Entry entry = entryKey;
String field = entry.field;
if (reader.maxDoc() == reader.docFreq(new Term(field))) {
return DocIdSet.EMPTY_DOCIDSET;
}
OpenBitSet res = new OpenBitSet(reader.maxDoc());
TermDocs termDocs = reader.termDocs();
TermEnum termEnum = reader.terms (new Term (field));
try {
do {
Term term = termEnum.term();
if (term==null || term.field() != field) break;
termDocs.seek (termEnum);
while (termDocs.next()) {
res.fastSet(termDocs.doc());
}
} while (termEnum.next());
} finally {
termDocs.close();
termEnum.close();
}
res.flip(0, reader.maxDoc());
return res;
}
}
代码示例来源:origin: tjake/Solandra
Term term = termEnum.term();
if (term == null || term.field() != field)
break;
代码示例来源:origin: tjake/Solandra
Term term = termEnum.term();
if (term == null || term.field() != field)
break;
代码示例来源:origin: tjake/Solandra
Term term = termEnum.term();
if (term == null || term.field() != field)
break;
代码示例来源:origin: tjake/Solandra
Term term = termEnum.term();
if (term == null || term.field() != field)
break;
代码示例来源:origin: linkedin/indextank-engine
int numberOfTerms = 0;
if (terms.term() != null) {
do {
Term term = terms.term();
if (term.compareTo(rightBoundary) >= 0) {
break;
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
public Term term() {
if (termEnum==null)
return null;
return termEnum.term();
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
public Term term() {
TermEnum terms = queue.peek();
if (terms != null) {
return terms.term();
}
return null;
}
代码示例来源:origin: apache/jackrabbit
public Term term() {
TermEnum terms = queue.peek();
if (terms != null) {
return terms.term();
}
return null;
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
final boolean next() throws IOException {
if (termEnum.next()) {
term = termEnum.term();
return true;
} else {
term = null;
return false;
}
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
final boolean next() throws IOException {
if (termEnum.next()) {
term = termEnum.term();
return true;
} else {
term = null;
return false;
}
}
代码示例来源:origin: indeedeng/imhotep
private boolean initialize() {
try {
termEnum = reader.terms(new Term(field, firstTerm));
} catch (IOException e) {
throw LuceneUtils.ioRuntimeException(e);
}
hasNext = termEnum.term() != null && field.equals(termEnum.term().field());
return hasNext;
}
代码示例来源:origin: tamingtext/book
/** populate the list of categories by reading the values from the categoryField in the index */
protected void scanCategories() throws IOException {
TermEnum te = indexReader.terms(new Term(categoryFieldName));
final Set c = categories;
do {
if (!te.term().field().equals(categoryFieldName)) break;
c.add(te.term().text());
} while (te.next());
log.info("Scanned " + c.size() + " categories from index");
}
代码示例来源:origin: tamingtext/book
protected float calculateWeight(Term term, IndexReader reader) throws IOException {
//if a term is not in the index, then it's weight is 0
TermEnum termEnum = reader.terms(term);
if (termEnum != null && termEnum.term() != null && termEnum.term().equals(term)) {
return 1.0f / termEnum.docFreq();
} else {
log.warn("Couldn't find doc freq for term {}", term);
return 0;
}
}
代码示例来源:origin: indeedeng/imhotep
@Override
public String term() {
sanityCheck();
return termEnum.term().text();
}
代码示例来源:origin: stackoverflow.com
TermEnum te = reader.terms(new Term("field", "app"));
List termList = new LinkedList();
while(te.next()) {
Term t = te.term();
if (!t.field().equals("field") || !t.text().startsWith("app")) {
break;
}
termList.add(t);
}
Term[] terms = termList.toArray(new Term[0]);
代码示例来源:origin: org.apache.lucene/lucene-spellchecker
TermIterator() throws IOException {
termsEnum = reader.terms(new Term(field, ""));
Term term = termsEnum.term();
if (term == null || term.field() != field) {
comp = null;
} else {
comp = BytesRef.getUTF8SortedAsUnicodeComparator();
}
}
代码示例来源:origin: stackoverflow.com
IndexReader reader = IndexReader.open(index);
TermEnum terms = reader.terms();
Set uniqueTerms = new HashSet();
while (terms.next()) {
final Term term = terms.term();
if (term.field().equals("field_name")) {
uniqueTerms.add(term.text());
}
}
代码示例来源:origin: altamiracorp/blur
private static Term getFirstTerm(Term t, SegmentReader reader) throws IOException {
TermEnum terms = reader.terms(t);
try {
if (terms.next()) {
return terms.term();
}
return null;
} finally {
terms.close();
}
}