optimized to allow segments=0
Merge branch 'master' of https://github.com/netarchivesuite/netsearch
refactor