Пример #1
0
 @Override
 protected Field parseCreateField(ParseContext context) throws IOException {
   // so, caching uid stream and field is fine
   // since we don't do any mapping parsing without immediate indexing
   // and, when percolating, we don't index the uid
   UidField field = fieldCache.get();
   field.setUid(Uid.createUid(context.stringBuilder(), context.type(), context.id()));
   context.uid(field);
   return field; // version get updated by the engine
 }
Пример #2
0
 @Override
 protected void parseCreateField(ParseContext context, List<Field> fields) throws IOException {
   Field uid =
       new Field(
           NAME,
           Uid.createUid(context.stringBuilder(), context.type(), context.id()),
           Defaults.FIELD_TYPE);
   context.uid(uid);
   fields.add(uid);
   if (fieldType().hasDocValues()) {
     fields.add(new BinaryDocValuesField(NAME, new BytesRef(uid.stringValue())));
   }
 }