开始

开始

方法二

DirectoryReader.openIfChanged(DirectoryReader oldReader, IndexCommit commit)

IndexWriter

是否为空?

u4_seg0 u4_seg1 u4_seg2 u4_seg3

indexCommit

是否为空?

根据Directory判断

索引是否发生变化?

返回null

u11_seg0 u11_seg1 u11_seg2 u11_seg3
u12_seg0 u12_seg1 u12_seg2
u13_seg0 u13_seg1 u13_seg2

方法一

DirectoryReader.openIfChanged(DirectoryReader oldReader)

segment_N文件

是否一致?

u16_seg0 u16_seg1 u16_seg2

结束

u19_seg0 u19_seg1
u20_seg0 u20_seg1 u20_seg2 u20_seg3
u21_seg0 u21_seg1 u21_seg2 u21_seg3
u22_seg0 u22_seg1 u22_seg2
u23_seg0 u23_seg1 u23_seg2

indexCommit

是否为空?

u27_seg0 u27_seg1 u27_seg2

获得所有段的信息集合

SegmentInfos

u30_seg0 u30_seg1 u30_seg2

根据IndexWriter判断

索引是否发生变化?

u33_seg0 u33_seg1 u33_seg2

根据IndexWriter获取新的

StandardDirectoryReader

新旧

StandardDirectoryReader

是否一致?

返回新的

StandardDirectoryReader

u37_seg0 u37_seg1
u38_seg0 u38_seg1
u39_seg0 u39_seg1

结束

返回null

u44_seg0 u44_seg1 u44_seg2
u45_seg0 u45_seg1 u45_seg2 u45_seg3
u46_seg0 u46_seg1 u46_seg2
u47_seg0 u47_seg1 u47_seg2 u47_seg3

返回新的

StandardDirectoryReader

u53_seg0 u53_seg1
u54_seg0 u54_seg1

返回新的

StandardDirectoryReader

u56_seg0 u56_seg1

获得所有段的信息集合

SegmentInfos

找出变更的LeafReader

u59_seg0 u59_seg1

找出变更的LeafReader

u61_seg0 u61_seg1
u62_seg0 u62_seg1