Any tricks to IndexReader.termDocs(Term)?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Any tricks to IndexReader.termDocs(Term)?

Fredrik Andersson-2-2
Hey Gang. Problem regarding the termDocs(Term) function, help most
appreciated.

// Create stored, indexed, non-tokenized field
Field field = new Field("someId", someInteger+"", true, true, false);
doc.add(field).

This field looks fine in Luke and can be read properly, however, when I try
to get all the documents with that certain someInteger:

indexReader.termDocs(new Term("someId", someInteger+""));

The returned TermDocs enumeration is empty. I have tried all the
combinations of stored/indexed/tokenized, but to no sucess. Any pointers on
what the heck is going on? I tried searching the "someId" field with Luke,
and I get no hits there either, even though the field looks fine and it's
indexed. I am using a StandardAnalyzer when writing the index.

Thanks,
Fredrik
Reply | Threaded
Open this post in threaded view
|

Re: Any tricks to IndexReader.termDocs(Term)?

Chris Hostetter-3

FYI: Assuming you are using that java port of lucene, then
[hidden email] is probably a more approriate list of these
types of questions.

: indexReader.termDocs(new Term("someId", someInteger+""));
:
: The returned TermDocs enumeration is empty. I have tried all the

define "empty" ... is the refrence returned null?  if it is not null, how
are you using it? ... are you calling next() once prior to calling either
doc() or freq()?  (per the documentation for each of those methods) ...
is the first call of next() returning false?

if you can post a short unit test using a RAMDirectory that demonstrates
your problem, it's more likely other people will be able to offer advice.



-Hoss