lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Sokolov <>
Subject Re: Searching number of tokens in text field
Date Sun, 29 Dec 2019 03:11:07 GMT
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 <> 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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message