> > 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?
Lucene in general will search all segments for primary key. But in case you want a little speed up, you can try Bloom Filtering Codec or Memory Codec if you can afford it -- Ravi On Sat, Apr 22, 2017 at 12:25 AM, Chris Hostetter <hossman_luc...@fucit.org> wrote: > : 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. > > Before you go too far down the rabit hole of writting any custom code, > make sure to do some experiements and actaully measure the performance of > a uniqueKey lookup using a simple needScores=false search ... the way > TermQuery works across each segments is very low cost for the segments > where the Term doesn't exist in any docs at all. > > > -Hoss > http://www.lucidworks.com/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >