That is a clever idea.  I would still prefer something cleaner but this
could work.  Thanks!

On Sat, Dec 28, 2019 at 10:11 PM Michael Sokolov <msoko...@gmail.com> wrote:

> I don't know of any pre-existing thing that does exactly this, but how
> about a token filter that counts tokens (or positions maybe), and then
> appends some special token encoding the length?
>
> On Sat, Dec 28, 2019, 9:36 AM Matt Davis <kryptonics...@gmail.com> wrote:
>
> > Hello,
> >
> > I was wondering if it is possible to search for the number of tokens in a
> > text field.  For example find book titles with 3 or more words.  I don't
> > mind adding a field that is the number of tokens to the search index but
> I
> > would like to avoid analyzing the text two times.   Can Lucene search for
> > the number of tokens in a text field?  Or can I get the number of tokens
> > after analysis and add it to the Lucene document before/during indexing?
> > Or do I need to analysis the text myself and add the field to the
> document
> > (analyze the text twice, once myself, once in the IndexWriter).
> >
> > Thanks,
> > Matt Davis
> >
>

Reply via email to