Hmmm, I dug around in the code and found this bit: * Forces merging of all segments that have deleted * documents. The actual merges to be executed are * determined by the {@link MergePolicy}. For example, * the default {@link TieredMergePolicy} will only * pick a segment if the percentage of * deleted docs is over 10%.
see IndexWriter.forceMergeDeletes. So perhaps this limit was never hit? Best Erick On Thu, Oct 11, 2012 at 6:10 PM, Shawn Heisey <s...@elyograg.org> wrote: > On 10/11/2012 2:02 PM, Shawn Heisey wrote: >> >> UpdateResponse ur = server.optimize(true, true, 20); >> >> What happens with this if I am already below 20 segments? Will it still >> expunge all of my (typically several thousand) deleted documents? I am >> hoping that what it will do is rebuild any segment that contains deleted >> documents and leave the other segments alone. > > > I have just tried this on a test system with 11 segments via curl, not > SolrJ. I don't expect that it would be any different with SolrJ, though. > > curl > 'http://localhost:8981/solr/s0live/update?optimize=true&maxSegments=20&expungeDeletes=true&waitFlush=true' > > It didn't work. When I changed maxSegments to 10, it did reduce the index > from 11 segments to 10, but there are still deleted documents in the index > -- maxDoc > numDocs on the statistics screen. > > numDocs : 12782762 > maxDoc : 12788156 > > I don't think expungeDeletes is actually a valid parameter for optimize, but > I included it anyway. I also tried doing a commit with expungeDeletes=true > and that didn't work either. > > Is this a bug? The server is 3.5.0. Because I haven't finished getting my > configuration worked out, I don't have the ability right now to try this on > 4.0.0. > > Thanks, > Shawn >