25
25
import org .apache .lucene .index .IndexableField ;
26
26
import org .apache .lucene .util .BytesRef ;
27
27
import org .elasticsearch .Version ;
28
+ import org .elasticsearch .common .time .DateFormatter ;
28
29
import org .elasticsearch .common .xcontent .XContentParser ;
29
30
import org .elasticsearch .index .IndexSettings ;
31
+ import org .elasticsearch .index .analysis .IndexAnalyzers ;
30
32
31
33
import java .util .ArrayList ;
32
34
import java .util .Collection ;
37
39
import java .util .List ;
38
40
import java .util .Set ;
39
41
40
- public abstract class ParseContext implements Iterable < ParseContext . Document > {
42
+ public abstract class ParseContext {
41
43
42
44
/** Fork of {@link org.apache.lucene.document.Document} with additional functionality. */
43
45
public static class Document implements Iterable <IndexableField > {
@@ -168,8 +170,8 @@ public Iterable<Document> nonRootDocuments() {
168
170
}
169
171
170
172
@ Override
171
- public DocumentMapperParser docMapperParser ( ) {
172
- return in .docMapperParser ( );
173
+ public Mapper . TypeParser . ParserContext parserContext ( DateFormatter dateFormatter ) {
174
+ return in .parserContext ( dateFormatter );
173
175
}
174
176
175
177
@ Override
@@ -207,6 +209,11 @@ public Document rootDoc() {
207
209
return in .rootDoc ();
208
210
}
209
211
212
+ @ Override
213
+ public List <Document > docs () {
214
+ return in .docs ();
215
+ }
216
+
210
217
@ Override
211
218
public Document doc () {
212
219
return in .doc ();
@@ -228,8 +235,8 @@ public DocumentMapper docMapper() {
228
235
}
229
236
230
237
@ Override
231
- public MapperService mapperService () {
232
- return in .mapperService ();
238
+ public IndexAnalyzers indexAnalyzers () {
239
+ return in .indexAnalyzers ();
233
240
}
234
241
235
242
@ Override
@@ -272,11 +279,6 @@ public List<Mapper> getDynamicMappers() {
272
279
return in .getDynamicMappers ();
273
280
}
274
281
275
- @ Override
276
- public Iterator <Document > iterator () {
277
- return in .iterator ();
278
- }
279
-
280
282
@ Override
281
283
public void addIgnoredField (String field ) {
282
284
in .addIgnoredField (field );
@@ -289,33 +291,20 @@ public Collection<String> getIgnoredFields() {
289
291
}
290
292
291
293
public static class InternalParseContext extends ParseContext {
292
-
293
294
private final DocumentMapper docMapper ;
294
-
295
295
private final ContentPath path ;
296
-
297
296
private final XContentParser parser ;
298
-
299
297
private final Document document ;
300
-
301
298
private final List <Document > documents ;
302
-
303
299
private final SourceToParse sourceToParse ;
304
-
300
+ private final long maxAllowedNumNestedDocs ;
301
+ private final List <Mapper > dynamicMappers ;
302
+ private final Set <String > ignoredFields = new HashSet <>();
305
303
private Field version ;
306
-
307
304
private SeqNoFieldMapper .SequenceIDFields seqID ;
308
-
309
- private final long maxAllowedNumNestedDocs ;
310
-
311
305
private long numNestedDocs ;
312
-
313
- private final List <Mapper > dynamicMappers ;
314
-
315
306
private boolean docsReversed = false ;
316
307
317
- private final Set <String > ignoredFields = new HashSet <>();
318
-
319
308
public InternalParseContext (DocumentMapper docMapper , SourceToParse source , XContentParser parser ) {
320
309
this .docMapper = docMapper ;
321
310
this .path = new ContentPath (0 );
@@ -331,8 +320,8 @@ public InternalParseContext(DocumentMapper docMapper, SourceToParse source, XCon
331
320
}
332
321
333
322
@ Override
334
- public DocumentMapperParser docMapperParser ( ) {
335
- return this . docMapper .documentMapperParser ();
323
+ public Mapper . TypeParser . ParserContext parserContext ( DateFormatter dateFormatter ) {
324
+ return docMapper .documentMapperParser (). parserContext ( dateFormatter );
336
325
}
337
326
338
327
@ Override
@@ -360,7 +349,8 @@ public Document rootDoc() {
360
349
return documents .get (0 );
361
350
}
362
351
363
- List <Document > docs () {
352
+ @ Override
353
+ public List <Document > docs () {
364
354
return this .documents ;
365
355
}
366
356
@@ -392,8 +382,8 @@ public DocumentMapper docMapper() {
392
382
}
393
383
394
384
@ Override
395
- public MapperService mapperService () {
396
- return docMapper .documentMapperParser (). mapperService ;
385
+ public IndexAnalyzers indexAnalyzers () {
386
+ return docMapper .indexAnalyzers () ;
397
387
}
398
388
399
389
@ Override
@@ -469,12 +459,6 @@ private List<Document> reorderParent(List<Document> docs) {
469
459
return newDocs ;
470
460
}
471
461
472
- @ Override
473
- public Iterator <Document > iterator () {
474
- return documents .iterator ();
475
- }
476
-
477
-
478
462
@ Override
479
463
public void addIgnoredField (String field ) {
480
464
ignoredFields .add (field );
@@ -503,7 +487,7 @@ public Collection<String> getIgnoredFields() {
503
487
*/
504
488
public abstract Collection <String > getIgnoredFields ();
505
489
506
- public abstract DocumentMapperParser docMapperParser ( );
490
+ public abstract Mapper . TypeParser . ParserContext parserContext ( DateFormatter dateFormatter );
507
491
508
492
/**
509
493
* Return a new context that will be within a copy-to operation.
@@ -580,6 +564,8 @@ public boolean isWithinMultiFields() {
580
564
581
565
public abstract Document rootDoc ();
582
566
567
+ public abstract List <Document > docs ();
568
+
583
569
public abstract Document doc ();
584
570
585
571
protected abstract void addDoc (Document doc );
@@ -588,7 +574,7 @@ public boolean isWithinMultiFields() {
588
574
589
575
public abstract DocumentMapper docMapper ();
590
576
591
- public abstract MapperService mapperService ();
577
+ public abstract IndexAnalyzers indexAnalyzers ();
592
578
593
579
public abstract Field version ();
594
580
0 commit comments