lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] [Updated] (LUCENE-8108) Field class should not let you analyze int values?
Date Tue, 26 Dec 2017 21:56:00 GMT


Michael McCandless updated LUCENE-8108:
    Attachment: LUCENE-8108.patch

Here's a patch with a failing test case; it creates a {{Field}} with an integer value and
with {{TextField.TYPE_STORED}} field type.

The test fails on the {{assertEquals}} because the token "17" was in fact created; this happens
because {{Field.stringValue}} calls {{.toString}} on numeric values ... I think this is somewhat
dangerously lenient but maybe it's not often hit because nobody would normally try to analyze
an int?

> Field class should not let you analyze int values?
> --------------------------------------------------
>                 Key: LUCENE-8108
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Michael McCandless
>         Attachments: LUCENE-8108.patch
> I stumbled on this by accident, by creating a {{Field}} instance with a {{Integer}} value
for its {{fieldsData}} and then setting {{tokenized = true}} in its {{FieldType}}.
> If you do this then Lucene silently converts the int to a string and then tokenizes it,
e.g. applying synonyms, etc., if that's what your analysis chain does.

This message was sent by Atlassian JIRA

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

View raw message