Re: testing whether a field has terms before adding document to Index

2013-02-06 Thread Michael McCandless
You could just create the TokenStream yourself, try to read the first token, and if you don't get a token (incrementToken returns false) then skip it? It's a bit wasteful since you'd then init a new TokenStream again if you do index it ... but maybe it's not so bad since you only read one token.

testing whether a field has terms before adding document to Index

2013-02-06 Thread Jon Stewart
Hello, 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: