lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Stewart <>
Subject testing whether a field has terms before adding document to Index
Date Wed, 06 Feb 2013 19:32:04 GMT

I have an application where a great many documents may not have any
terms after StandardAnalyzer has had its way with the body. In that
case, depending on some other metadata, I may not wish to add the
document to the index altogether. Is there a way to tell?

i.e., current I'm doing this:

Document doc = new Document();
doc.addField(new Field("body", bodyString, INDEXED | etc));

and I'd like to do this:

Field body = new Field("body", bodyString, INDEXED | etc);
if (body has terms post-analysis) {
  Document doc = new Document();

Is it possible to do this? I don't mind jumping through some hoops.


Jon Stewart, Principal
(646) 719-0317 | | Arlington, VA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message