开始

开始

方法二

DirectoryReader.openIfChanged(DirectoryReader oldReader, IndexCommit commit)

IndexWriter

是否为空?

u62_seg0 u62_seg1 u62_seg2 u62_seg3

indexCommit

是否为空?

根据Directory判断

索引是否发生变化?

返回null

u69_seg0 u69_seg1 u69_seg2 u69_seg3
u70_seg0 u70_seg1 u70_seg2
u71_seg0 u71_seg1 u71_seg2

方法一

DirectoryReader.openIfChanged(DirectoryReader oldReader)

segment_N文件

是否一致?

u74_seg0 u74_seg1 u74_seg2

结束

u77_seg0 u77_seg1
u78_seg0 u78_seg1 u78_seg2 u78_seg3
u79_seg0 u79_seg1 u79_seg2 u79_seg3
u80_seg0 u80_seg1 u80_seg2
u81_seg0 u81_seg1 u81_seg2

indexCommit

是否为空?

u85_seg0 u85_seg1 u85_seg2

获得所有段的信息集合

SegmentInfos

u88_seg0 u88_seg1 u88_seg2

根据IndexWriter判断

索引是否发生变化?

u91_seg0 u91_seg1 u91_seg2

根据IndexWriter获取新的

StandardDirectoryReader

新旧

StandardDirectoryReader

是否一致?

返回新的

StandardDirectoryReader

u95_seg0 u95_seg1
u96_seg0 u96_seg1
u97_seg0 u97_seg1

结束

返回null

u102_seg0 u102_seg1 u102_seg2
u103_seg0 u103_seg1 u103_seg2 u103_seg3
u104_seg0 u104_seg1 u104_seg2
u105_seg0 u105_seg1 u105_seg2 u105_seg3

返回新的

StandardDirectoryReader

u111_seg0 u111_seg1
u112_seg0 u112_seg1

返回新的

StandardDirectoryReader

u114_seg0 u114_seg1

获得所有段的信息集合

SegmentInfos

找出变更的LeafReader

u117_seg0 u117_seg1

找出变更的LeafReader

u119_seg0 u119_seg1
u120_seg0 u120_seg1