lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Taylor <paul_t...@fastmail.fm>
Subject Re: How do you check a field has been indexed correctly if not stored ?
Date Wed, 06 Jan 2010 10:21:09 GMT
Simon Willnauer wrote:
> Would indexReader#termDocs() help? You get all docs containing a
> specific term - that way you could iterate in reverse order though.
>
> simon

Thanks, almost if I do this I can determine that a document exists  with 
a term with a particular value works

 TermDocs termDocs = ir.termDocs(new 
Term(ArtistIndexField.ARTIST_ID.getName(),"4302e264-1cf0-4d1f-aca7-2a6f89e34b36"));
 termDocs.next();
 assertEquals(1,termDocs.freq());

but this doesnt work

 TermDocs termDocs = ir.termDocs(new 
Term(ArtistIndexField.ARTIST_ID.getName()));
 termDocs.next();
 assertEquals(1,termDocs.freq());

which is what I really want, i.e that document has a term for this fieldname

(In any test there is only ever one document)

Paul



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


Mime
View raw message