开始

开始

方法二

DirectoryReader.openIfChanged(DirectoryReader oldReader, IndexCommit commit)

IndexWriter

是否为空?

u183_seg0 u183_seg1 u183_seg2 u183_seg3

indexCommit

是否为空?

根据Directory判断

索引是否发生变化?

返回null

u190_seg0 u190_seg1 u190_seg2 u190_seg3
u191_seg0 u191_seg1 u191_seg2
u192_seg0 u192_seg1 u192_seg2

方法一

DirectoryReader.openIfChanged(DirectoryReader oldReader)

segment_N文件

是否一致?

u195_seg0 u195_seg1 u195_seg2

结束

u198_seg0 u198_seg1
u199_seg0 u199_seg1 u199_seg2 u199_seg3
u200_seg0 u200_seg1 u200_seg2 u200_seg3
u201_seg0 u201_seg1 u201_seg2
u202_seg0 u202_seg1 u202_seg2

indexCommit

是否为空?

u206_seg0 u206_seg1 u206_seg2

获得所有段的信息集合

SegmentInfos

u209_seg0 u209_seg1 u209_seg2

根据IndexWriter判断

索引是否发生变化?

u212_seg0 u212_seg1 u212_seg2

根据IndexWriter获取新的

StandardDirectoryReader

新旧

StandardDirectoryReader

是否一致?

返回新的

StandardDirectoryReader

u216_seg0 u216_seg1
u217_seg0 u217_seg1
u218_seg0 u218_seg1

结束

返回null

u223_seg0 u223_seg1 u223_seg2
u224_seg0 u224_seg1 u224_seg2 u224_seg3
u225_seg0 u225_seg1 u225_seg2
u226_seg0 u226_seg1 u226_seg2 u226_seg3

返回新的

StandardDirectoryReader

u232_seg0 u232_seg1
u233_seg0 u233_seg1

返回新的

StandardDirectoryReader

u235_seg0 u235_seg1

获得所有段的信息集合

SegmentInfos

找出变更的LeafReader

u238_seg0 u238_seg1

找出变更的LeafReader

u240_seg0 u240_seg1
u241_seg0 u241_seg1