コード例 #1
0
  /** @return a string representing a SchemaField's flags. */
  private static String getFieldFlags(SchemaField f) {
    FieldType t = (f == null) ? null : f.getType();

    // see: http://www.nabble.com/schema-field-properties-tf3437753.html#a9585549
    boolean lazy = false; // "lazy" is purely a property of reading fields
    boolean binary = false; // Currently not possible

    StringBuilder flags = new StringBuilder();
    flags.append((f != null && f.indexed()) ? FieldFlag.INDEXED.getAbbreviation() : '-');
    flags.append((t != null && t.isTokenized()) ? FieldFlag.TOKENIZED.getAbbreviation() : '-');
    flags.append((f != null && f.stored()) ? FieldFlag.STORED.getAbbreviation() : '-');
    flags.append((f != null && f.multiValued()) ? FieldFlag.MULTI_VALUED.getAbbreviation() : '-');
    flags.append(
        (f != null && f.storeTermVector()) ? FieldFlag.TERM_VECTOR_STORED.getAbbreviation() : '-');
    flags.append(
        (f != null && f.storeTermOffsets()) ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation() : '-');
    flags.append(
        (f != null && f.storeTermPositions())
            ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation()
            : '-');
    flags.append((f != null && f.omitNorms()) ? FieldFlag.OMIT_NORMS.getAbbreviation() : '-');
    flags.append(
        (f != null && f.omitTermFreqAndPositions()) ? FieldFlag.OMIT_TF.getAbbreviation() : '-');
    flags.append(
        (f != null && f.omitPositions()) ? FieldFlag.OMIT_POSITIONS.getAbbreviation() : '-');
    flags.append((lazy) ? FieldFlag.LAZY.getAbbreviation() : '-');
    flags.append((binary) ? FieldFlag.BINARY.getAbbreviation() : '-');
    flags.append(
        (f != null && f.sortMissingFirst()) ? FieldFlag.SORT_MISSING_FIRST.getAbbreviation() : '-');
    flags.append(
        (f != null && f.sortMissingLast()) ? FieldFlag.SORT_MISSING_LAST.getAbbreviation() : '-');
    return flags.toString();
  }
コード例 #2
0
 /** @return a key to what each character means */
 public static SimpleOrderedMap<String> getFieldFlagsKey() {
   SimpleOrderedMap<String> key = new SimpleOrderedMap<String>();
   key.add(String.valueOf(FieldFlag.INDEXED.getAbbreviation()), FieldFlag.INDEXED.getDisplay());
   key.add(
       String.valueOf(FieldFlag.TOKENIZED.getAbbreviation()), FieldFlag.TOKENIZED.getDisplay());
   key.add(String.valueOf(FieldFlag.STORED.getAbbreviation()), FieldFlag.STORED.getDisplay());
   key.add(
       String.valueOf(FieldFlag.MULTI_VALUED.getAbbreviation()),
       FieldFlag.MULTI_VALUED.getDisplay());
   key.add(
       String.valueOf(FieldFlag.TERM_VECTOR_STORED.getAbbreviation()),
       FieldFlag.TERM_VECTOR_STORED.getDisplay());
   key.add(
       String.valueOf(FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation()),
       FieldFlag.TERM_VECTOR_OFFSET.getDisplay());
   key.add(
       String.valueOf(FieldFlag.TERM_VECTOR_POSITION.getAbbreviation()),
       FieldFlag.TERM_VECTOR_POSITION.getDisplay());
   key.add(
       String.valueOf(FieldFlag.OMIT_NORMS.getAbbreviation()), FieldFlag.OMIT_NORMS.getDisplay());
   key.add(String.valueOf(FieldFlag.LAZY.getAbbreviation()), FieldFlag.LAZY.getDisplay());
   key.add(String.valueOf(FieldFlag.BINARY.getAbbreviation()), FieldFlag.BINARY.getDisplay());
   key.add(
       String.valueOf(FieldFlag.SORT_MISSING_FIRST.getAbbreviation()),
       FieldFlag.SORT_MISSING_FIRST.getDisplay());
   key.add(
       String.valueOf(FieldFlag.SORT_MISSING_LAST.getAbbreviation()),
       FieldFlag.SORT_MISSING_LAST.getDisplay());
   return key;
 }
コード例 #3
0
 /** @return a string representing a Fieldable's flags. */
 private static String getFieldFlags(Fieldable f) {
   StringBuilder flags = new StringBuilder();
   flags.append((f != null && f.isIndexed()) ? FieldFlag.INDEXED.getAbbreviation() : '-');
   flags.append((f != null && f.isTokenized()) ? FieldFlag.TOKENIZED.getAbbreviation() : '-');
   flags.append((f != null && f.isStored()) ? FieldFlag.STORED.getAbbreviation() : '-');
   flags.append((false) ? FieldFlag.MULTI_VALUED.getAbbreviation() : '-'); // SchemaField Specific
   flags.append(
       (f != null && f.isTermVectorStored())
           ? FieldFlag.TERM_VECTOR_STORED.getAbbreviation()
           : '-');
   flags.append(
       (f != null && f.isStoreOffsetWithTermVector())
           ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation()
           : '-');
   flags.append(
       (f != null && f.isStorePositionWithTermVector())
           ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation()
           : '-');
   flags.append((f != null && f.getOmitNorms()) ? FieldFlag.OMIT_NORMS.getAbbreviation() : '-');
   flags.append((f != null && f.isLazy()) ? FieldFlag.LAZY.getAbbreviation() : '-');
   flags.append((f != null && f.isBinary()) ? FieldFlag.BINARY.getAbbreviation() : '-');
   flags.append(
       (false) ? FieldFlag.SORT_MISSING_FIRST.getAbbreviation() : '-'); // SchemaField Specific
   flags.append(
       (false) ? FieldFlag.SORT_MISSING_LAST.getAbbreviation() : '-'); // SchemaField Specific
   return flags.toString();
 }