You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Paul Sitowitz <si...@gmail.com> on 2013/01/29 20:30:35 UTC

Migration to Lucene 4.1

Hello,

I currently have the following production code which currently works with
Lucene 3.0:

this.luceneWriter = new IndexWriter( directory, analyzer, true,
MaxFieldLength.UNLIMITED );
this.fs.delete( this.finalOutput, true );
this.luceneWriter.setUseCompoundFile( true );
this.luceneWriter.setMergeFactor( job.getInt( "indexer.mergeFactor", 1000 )
);
this.luceneWriter.setMaxBufferedDocs( job.getInt( "indexer.minMergeDocs",
1000 ) );
this.luceneWriter.setMaxMergeDocs( job.getInt( "indexer.maxMergeDocs",
Integer.MAX_VALUE ) );

LuceneMergeRecordWriter.this.setStatus( "Adding indexes" );
LuceneMergeRecordWriter.this.luceneWriter.addIndexesNoOptimize(
LuceneMergeRecordWriter.this.luceneIndexes
                                        .toArray( new
Directory[LuceneMergeRecordWriter.this.luceneIndexes.size()] ) );

LuceneMergeRecordWriter.this.setStatus( "Optimizing index" );
LuceneMergeRecordWriter.this.luceneWriter.optimize()

I am in the process of upgrading to Lucene 4.1 but have run into some
unknown API issues. Can someone help to point out what the equivalent 4.1
code would look like?

Here is some of the partial 4.1 code that I have thus far:

        this.fs.delete( this.finalOutput, true );
        IndexWriterConfig iwconf = new IndexWriterConfig(Version.LUCENE_41,
analyzer);
        iwconf.setOpenMode( IndexWriterConfig.OpenMode.CREATE );
        iwconf.setMaxBufferedDocs( conf.getInt( "indexer.minMergeDocs",
1000 ) );
        ..................
        this.luceneWriter = new IndexWriter( directory, iwconf );

Thanks,

Paul

-- 
------------------------------------------
Paul Sitowitz
sitowitz@gmail.com
703-626-3593

Re: Migration to Lucene 4.1

Posted by Ian Lea <ia...@gmail.com>.
Have you read the changes and migration docs that come with 4.1?  You
may also need to look at 3.[123456] javadocs to see deprecations and
alternatives for stuff that was present in 3.0 but gone in 4.1.


--
Ian.

On Tue, Jan 29, 2013 at 7:30 PM, Paul Sitowitz <si...@gmail.com> wrote:
> Hello,
>
> I currently have the following production code which currently works with
> Lucene 3.0:
>
> this.luceneWriter = new IndexWriter( directory, analyzer, true,
> MaxFieldLength.UNLIMITED );
> this.fs.delete( this.finalOutput, true );
> this.luceneWriter.setUseCompoundFile( true );
> this.luceneWriter.setMergeFactor( job.getInt( "indexer.mergeFactor", 1000 )
> );
> this.luceneWriter.setMaxBufferedDocs( job.getInt( "indexer.minMergeDocs",
> 1000 ) );
> this.luceneWriter.setMaxMergeDocs( job.getInt( "indexer.maxMergeDocs",
> Integer.MAX_VALUE ) );
>
> LuceneMergeRecordWriter.this.setStatus( "Adding indexes" );
> LuceneMergeRecordWriter.this.luceneWriter.addIndexesNoOptimize(
> LuceneMergeRecordWriter.this.luceneIndexes
>                                         .toArray( new
> Directory[LuceneMergeRecordWriter.this.luceneIndexes.size()] ) );
>
> LuceneMergeRecordWriter.this.setStatus( "Optimizing index" );
> LuceneMergeRecordWriter.this.luceneWriter.optimize()
>
> I am in the process of upgrading to Lucene 4.1 but have run into some
> unknown API issues. Can someone help to point out what the equivalent 4.1
> code would look like?
>
> Here is some of the partial 4.1 code that I have thus far:
>
>         this.fs.delete( this.finalOutput, true );
>         IndexWriterConfig iwconf = new IndexWriterConfig(Version.LUCENE_41,
> analyzer);
>         iwconf.setOpenMode( IndexWriterConfig.OpenMode.CREATE );
>         iwconf.setMaxBufferedDocs( conf.getInt( "indexer.minMergeDocs",
> 1000 ) );
>         ..................
>         this.luceneWriter = new IndexWriter( directory, iwconf );
>
> Thanks,
>
> Paul
>
> --
> ------------------------------------------
> Paul Sitowitz
> sitowitz@gmail.com
> 703-626-3593

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org