Lucene - Core
  1. Lucene - Core
  2. LUCENE-3777

trapping overloaded ctors/setters in Field/NumericField/DocValuesField

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 4.0-ALPHA
    • Fix Version/s: 4.0-ALPHA
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      In trunk, these apis let you easily create a field, but my concern is this:

      public NumericField(String name, int value)
      public NumericField(String name, long value)
      ..
      public Field(String name, int value, FieldType type)
      public Field(String name, long value, FieldType type)
      ..
      public void setValue(int value)
      public void setValue(long value)
      ..
      public DocValuesField(String name, int value, DocValues.Type docValueType)
      public DocValuesField(String name, long value, DocValues.Type docValueType)
      

      I really don't like overloaded ctors/setters where the compiler can type-promote you,
      I think it makes the apis hard to use.

      Instead for the setters I think we sohuld have setIntValue, setLongValue, ...
      For the ctors, I see two other options:

      1. factories like DocValuesField.newIntField()
      2. subclasses like IntField

      I don't have any patch for this, but I think we should discuss and fix before these apis are released.

      1. LUCENE-3777.patch
        177 kB
        Michael McCandless
      2. LUCENE-3777.patch
        86 kB
        Michael McCandless

        Activity

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Robert Muir
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development