Lucene by default will search all segments, because it does not know that your field is a primary key.
Trejkaz's suggestion to early-terminate should work well. You could also write custom code that uses TermsEnum on each segment. Mike McCandless http://blog.mikemccandless.com On Thu, Apr 20, 2017 at 11:09 PM, 马可阳 <makey...@jd.com> wrote: > Let’s say I have a user info index and user id is the ‘primary key’. So > when I do a userid term search, will lucene traverse all segments to search > a 'primary key'term or will it stop as soon as it get one? > > If it is the latter one, will any plan to make it the former way? > > > 马可阳 > > 京东 【基础平台|中间件|JSF】 > ===================================== > 服务构建 jsf.jd.com > >