Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseSearchIndex loadFromIndex must inovke writer.maybeMerge() after writer.addIndexesNoOptimize(new Directory[] { dir }) use with lucene 3.4 #8

Open
wangscu opened this issue Oct 15, 2011 · 1 comment

Comments

@wangscu
Copy link

wangscu commented Oct 15, 2011

in Lucene 3.4 writer.addIndexes(new Directory[] { dir }) does not merge any more, so we must inoke maybeMerge after add dir to index. :)

public void loadFromIndex(BaseSearchIndex<R> index) throws IOException
{
    // hao: open readOnly ram index reader
    ZoieIndexReader<R> reader = index.openIndexReader();
    if (reader == null)
        return;

    Directory dir = reader.directory();

    // hao: delete docs in disk index
    LongSet delDocs = _delDocs;
    clearDeletes();
    deleteDocs(delDocs);

    // hao: merge the readOnly ram index with the disk index
    IndexWriter writer = null;
    try
    {
        writer = openIndexWriter(null, null);
        writer.addIndexes(new Directory[] { dir });
        writer.maybeMerge();
    } finally
    {
        closeIndexWriter();
    }
} 
@javasoze
Copy link
Contributor

isn't maybeMerge already added in the code? If not, we will just need to merge up.

jhartman referenced this issue in jhartman/zoie Aug 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants