You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Shawn Konopinsky <sk...@blueprint.org> on 2004/07/20 22:27:28 UTC

Limiting Term Queries

Is it possible to limit a term query?

For example: I am indexing documents with (amongst other things)  a
string in one field and with a number in another field. All combinations
of strings and numbers are allowed and neither field is unique. I would
like a way to query Lucene to pull out all unique numbers for a specific
letter.

If I had: (a, 123) (b, 123) (a, 123) (b, 23) (a, 45)
I would want a way to pull all unqiue numbers such that the string is
'a':
- (a, 123) (a, 45)

Right now I am determining the unique numbers by performing a term
query: TermEnum enumerator = reader.terms(new Term(number_field, ""));

where reader is an IndexReader and number_field is the field containing
the number. This gives me a list of all unique numbers, but counts those
documents that might have different letters (i.e. not just 'a').

Any thoughts on this?

Shawn.


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org