lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brendan Grainger <>
Subject Ordering of terms in TermsEnum
Date Wed, 22 May 2013 15:28:36 GMT
Hi All,

Sorry if this is a stupid question, but I'm still catching up with some of
the new APIs and I want to make sure my assumptions are correct.

Anyway, I'm the solr PathHierachyTokenizer to create a number of paths,
e.g. for a book object say with a category field of /compsci/search/lucene
the PathHierachyTokenizer creates the following tokens and they are added
to a multivalued field called 'categories'


I then want to iterate over these categories using a TermsEnum. This is the
relevant code:

  Terms terms = fields.terms('categories');
  if (terms == null) return null;
  TermsEnum termsEnum = terms.iterator(null);

  BytesRef text;
  while((text = != null) {
     System.out.println("field=categories; text=" + text.utf8ToString());

My question is, is it guaranteed that the order of the terms as they're
enumerated will be


and if in another document I added /compsci/graphics/3d then the terms as
I enumerate them would be:


If anyone can point me to a good doc or tutorial discussing this that'd be
great too.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message