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 Cam Bazz <ca...@gmail.com> on 2008/09/15 19:32:07 UTC

2.4 questions

Hello,

I see that IndexWriter.flush() is depreciated in 2.4. What do we use?

Also I used to make a:

        try {
            nodeWriter = new IndexWriter(nodeDir, true, analyzer, false);
        } catch(FileNotFoundException e) {
            nodeWriter = new IndexWriter(nodeDir, true, analyzer, true);
        }


it seems that the constructor for indexwriter is also depreciated.

Any ideas?

Best.

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


Re: 2.4 questions

Posted by Michael McCandless <lu...@mikemccandless.com>.
We are in the [slowish] process of releasing 2.4 now -- we are down to  
3 2.4 issues:

     https://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&mode=hide&sorter/order=DESC&sorter/field=priority&resolution=-1&pid=12310110&fixfor=12312681

Once these are resolved then we'll work through the release process.

Yes alot has changed!

Mike

Cam Bazz wrote:

> out of curiousity and somewhat unrelated to this thread. when can we
> expect to see 2.4?
>
> it seems much much as changed. so people would want to port their  
> code?
>
> Best.
>
> On Mon, Sep 15, 2008 at 10:56 PM, Michael McCandless
> <lu...@mikemccandless.com> wrote:
>>
>> Cam Bazz wrote:
>>
>>> well, I did not understand here.
>>>
>>> so there is a no way of using the new constructor - and specify
>>> autoCommit = false ?
>>
>> That's right, until 3.0.
>>
>> I would prefer to have a new API, introduced in 2.4 and kept in  
>> 3.0, that
>> has autoCommit=false as its default (without being specified as a  
>> param) but
>> I don't see how to cleanly do that.
>>
>> Mike
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


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


Re: 2.4 questions

Posted by Cam Bazz <ca...@gmail.com>.
out of curiousity and somewhat unrelated to this thread. when can we
expect to see 2.4?

it seems much much as changed. so people would want to port their code?

Best.

On Mon, Sep 15, 2008 at 10:56 PM, Michael McCandless
<lu...@mikemccandless.com> wrote:
>
> Cam Bazz wrote:
>
>> well, I did not understand here.
>>
>> so there is a no way of using the new constructor - and specify
>> autoCommit = false ?
>
> That's right, until 3.0.
>
> I would prefer to have a new API, introduced in 2.4 and kept in 3.0, that
> has autoCommit=false as its default (without being specified as a param) but
> I don't see how to cleanly do that.
>
> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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


Re: 2.4 questions

Posted by Michael McCandless <lu...@mikemccandless.com>.
Cam Bazz wrote:

> well, I did not understand here.
>
> so there is a no way of using the new constructor - and specify
> autoCommit = false ?

That's right, until 3.0.

I would prefer to have a new API, introduced in 2.4 and kept in 3.0,  
that has autoCommit=false as its default (without being specified as a  
param) but I don't see how to cleanly do that.

Mike

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


Re: 2.4 questions

Posted by Cam Bazz <ca...@gmail.com>.
well, I did not understand here.

so there is a no way of using the new constructor - and specify
autoCommit = false ?

Best

On Mon, Sep 15, 2008 at 10:30 PM, Michael McCandless
<lu...@mikemccandless.com> wrote:
>
> Cam Bazz wrote:
>
>> However the documentation states that autoCommit=true.
>
> For now, keep using the deprecated API and specify autoCommit=false.  Then
> in 3.0, when IndexWriter switches to autoCommit=false, remove the boolean
> autoCommit from your constructor.
>
>> How do we disable this? In 2.3 I used to do a:
>>
>> writer.setMaxBufferedDocs(IndexWriter.DISABLE_AUTO_FLUSH);
>>
>> would that totally disable autoCommit, or will it autoCommit when the
>> ram usage reaches a certain criteria.
>
> Actually, this (maxBufferedDocs, as well as ramBufferSizeMB) controls when
> buffered docs in RAM are written as a new segment to disk.  When such a
> segment is created, it's not yet referenced by a segments_N file (thus a
> newly opened IndexReader won't see them) until a commit (or flush) happens.
>
> autoCommit=true, instead, means IndexWriter will periodically (on it's own
> schedule) call commit() internally.
>
> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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


Re: 2.4 questions

Posted by Michael McCandless <lu...@mikemccandless.com>.
Cam Bazz wrote:

> However the documentation states that autoCommit=true.

For now, keep using the deprecated API and specify autoCommit=false.   
Then in 3.0, when IndexWriter switches to autoCommit=false, remove the  
boolean autoCommit from your constructor.

> How do we disable this? In 2.3 I used to do a:
>
> writer.setMaxBufferedDocs(IndexWriter.DISABLE_AUTO_FLUSH);
>
> would that totally disable autoCommit, or will it autoCommit when the
> ram usage reaches a certain criteria.

Actually, this (maxBufferedDocs, as well as ramBufferSizeMB) controls  
when buffered docs in RAM are written as a new segment to disk.  When  
such a segment is created, it's not yet referenced by a segments_N  
file (thus a newly opened IndexReader won't see them) until a commit  
(or flush) happens.

autoCommit=true, instead, means IndexWriter will periodically (on it's  
own schedule) call commit() internally.

Mike

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


Re: 2.4 questions

Posted by Cam Bazz <ca...@gmail.com>.
great!

well I never use autoCommit=true.

However the documentation states that autoCommit=true.

How do we disable this? In 2.3 I used to do a:

writer.setMaxBufferedDocs(IndexWriter.DISABLE_AUTO_FLUSH);

would that totally disable autoCommit, or will it autoCommit when the
ram usage reaches a certain criteria.

Best.

On Mon, Sep 15, 2008 at 10:05 PM, Michael McCandless
<lu...@mikemccandless.com> wrote:
>
> Cam Bazz wrote:
>
>> Hello,
>>
>> I see that IndexWriter.flush() is depreciated in 2.4. What do we use?
>
> Looks like you already found it, but the javadoc says this:
>
>     * @deprecated please call {@link #commit()}) instead
>
>>
>> Also I used to make a:
>>
>>       try {
>>           nodeWriter = new IndexWriter(nodeDir, true, analyzer, false);
>>       } catch(FileNotFoundException e) {
>>           nodeWriter = new IndexWriter(nodeDir, true, analyzer, true);
>>       }
>>
>>
>> it seems that the constructor for indexwriter is also depreciated.
>
> I just fixed the javadoc to say:
>
>   *  Use {@link #IndexWriter(Directory,Analyzer,boolean,MaxFieldLength)}
> instead.
>
> There were two changes that affect that constructor.  First, the autoCommit
> boolean will go away in 3.0, and IndexWriter will be hardwired to
> "autoCommit=false".  You can always call commit on your own schedule if
> needed.  Second, all IndexWriter ctor's now take an
> IndexWriter.MaxFieldLength instance (you can use LIMITED or UNLIMITED, or
> make your own).  This is just making the usual maxFieldLength setting in
> IndexWriter more in-your-face so that everyone is aware when they make an
> IndexWriter that it can truncate input documents (since it was a trap
> before).
>
> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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


Re: 2.4 questions

Posted by Michael McCandless <lu...@mikemccandless.com>.
Cam Bazz wrote:

> Hello,
>
> I see that IndexWriter.flush() is depreciated in 2.4. What do we use?

Looks like you already found it, but the javadoc says this:

      * @deprecated please call {@link #commit()}) instead

>
> Also I used to make a:
>
>        try {
>            nodeWriter = new IndexWriter(nodeDir, true, analyzer,  
> false);
>        } catch(FileNotFoundException e) {
>            nodeWriter = new IndexWriter(nodeDir, true, analyzer,  
> true);
>        }
>
>
> it seems that the constructor for indexwriter is also depreciated.

I just fixed the javadoc to say:

    *  Use {@link  
#IndexWriter(Directory,Analyzer,boolean,MaxFieldLength)} instead.

There were two changes that affect that constructor.  First, the  
autoCommit boolean will go away in 3.0, and IndexWriter will be  
hardwired to "autoCommit=false".  You can always call commit on your  
own schedule if needed.  Second, all IndexWriter ctor's now take an  
IndexWriter.MaxFieldLength instance (you can use LIMITED or UNLIMITED,  
or make your own).  This is just making the usual maxFieldLength  
setting in IndexWriter more in-your-face so that everyone is aware  
when they make an IndexWriter that it can truncate input documents  
(since it was a trap before).

Mike

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