You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by George Aroush <ge...@aroush.net> on 2009/09/17 04:32:04 UTC

Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George


Re: Port of Java Lucene 2.9 is under way

Posted by Glyn Darkin <gl...@darkinsystems.com>.
Thankyou George, Looking forward to the new release.

Glyn

2009/9/17 George Aroush <ge...@aroush.net>:
> Hi folks,
>
>
>
> This is to let you know that I have begun the porting process of Java Lucene
> 2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
> early release checked-into SVN.
>
>
>
> If you are following Java Lucene mailing list, you will know that 2.9 is
> currently undergoing release as Release Candidate 4 and RC5 is expected (a
> bug was found in RC4).  My port is based on RC3, but changes between Java
> Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.
>
>
>
> With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
> releases very close; my hope is, any further ports should be an accumulation
> of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
> release.  I'm not sure if this goal can be achieved, but we will see.
>
>
>
> Regards,
>
>
>
> -- George
>
>



-- 
Glyn Darkin

Darkin Systems Ltd
Mob: 07961815649
Fax: 08717145065
Web: www.darkinsystems.com

Company No: 6173001
VAT No: 906350835

RE: Port of Java Lucene 2.9 is under way

Posted by Digy <di...@gmail.com>.
* With a "IndexSearcher.Close",
  a) If your IndexSearcher is created with "new IndexSearcher(IndexReader r)" then "r" is not closed. 
  b) But if you have created it by giving a directory then the internal IndexReader is closed.

* If you close the IndexReader directly, you don't have to close the related IndexSearcher since it has nothing to free.

DIGY



-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Friday, October 16, 2009 8:27 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Digy

Thanks for your help.

I have a question here.
I use the reader for other tasks, and later in my code the reader (_ir) is closed, and I just keep open the searcher. Or sometimes viceversa, I close the searcher and just keep the Reader open.
If I use a single Reader on both instances(_ir and _is), what happens if I close either one or the other? Wouldn’t the other one be closed too? 
Or that means that I can use a single Reader to open different instances of IndexSearcher and close an IndexSearcher without affecting the other Searcher instances?

Best regards
Luis

-----Original Message-----
From: Digy [mailto:digydigy@gmail.com] 
Sent: Friday, October 16, 2009 12:03 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Luis,

 

I think, you shouldn't reopen "_is.Reader". Just create a new IndexSearcher with the new "_ir".

Your code(converted to c#) is below. See the comments.

 

            IndexReader newR = _ir.Reopen();

            if (newR != _ir)

            {

                _ir.Close();

            }

            _ir = newR;

 

            //REMOVED

            //IndexReader newSR = _is.Reader.Reopen();

            //if (newSR != _is.Reader)

            //{

            //    _is.Close();

            //}

            //_is = new IndexSearcher(newSR);

            _is = new IndexSearcher(_ir); //<--ADDED

 

DIGY

 

 

 

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Friday, October 16, 2009 6:49 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi all

 

I've just created a new test project and I confirm that the exception occurs.

 

The steps to reproduce:

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Reopen Searcer and/or Reader. (Click "Reopen" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: 

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\Directory.cs:line 244

   at Lucene.Net.Store.FSDirectory.List() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\FSDirectory.cs:line 386

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 620

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 473

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\DirectoryIndexReader.cs:line 232

   at LuceneReopenTest.Form1.btnIsCurent_Click(Object sender, EventArgs e) in G:\Installers\Desarrollo\LuceneNET\Tests\LuceneReopenTest\LuceneReopenTest\Form1.vb:line 268"

 

If instead of using Reopen you do a Close + Open, there is no exception.

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Close+Open Searcer and/or Reader. (Click "Close" then the "Open" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: TRUE    :-)

 

My test project code is below. It is just a VB project with a single form.

Just create a new form, delete the "Form1.Designer.vb" file and paste the code in the "Form1.vb".

=======================================================

Imports Lucene.Net.Index

Imports Lucene.Net.Search

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Class Form1

    Inherits System.Windows.Forms.Form

 

    'Form overrides dispose to clean up the component list.

    <System.Diagnostics.DebuggerNonUserCode()> _

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

        Try

            If disposing AndAlso components IsNot Nothing Then

                components.Dispose()

            End If

        Finally

            MyBase.Dispose(disposing)

        End Try

    End Sub

 

    'Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

 

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer.  

    'Do not modify it using the code editor.

    <System.Diagnostics.DebuggerStepThrough()> _

    Private Sub InitializeComponent()

        Me.txtIndexFolder = New System.Windows.Forms.TextBox

        Me.btnBrowseFolder = New System.Windows.Forms.Button

        Me.bntOpen = New System.Windows.Forms.Button

        Me.btnClose = New System.Windows.Forms.Button

        Me.btnReopen = New System.Windows.Forms.Button

        Me.btnIsCurent = New System.Windows.Forms.Button

        Me.btnSearch = New System.Windows.Forms.Button

        Me.txtSearch = New System.Windows.Forms.TextBox

        Me.StatusStrip1 = New System.Windows.Forms.StatusStrip

        Me.statusLabel = New System.Windows.Forms.ToolStripStatusLabel

        Me.btnAdd = New System.Windows.Forms.Button

        Me.StatusStrip1.SuspendLayout()

        Me.SuspendLayout()

        '

        'txtIndexFolder

        '

        Me.txtIndexFolder.Location = New System.Drawing.Point(12, 12)

        Me.txtIndexFolder.Name = "txtIndexFolder"

        Me.txtIndexFolder.Size = New System.Drawing.Size(713, 20)

        Me.txtIndexFolder.TabIndex = 0

        '

        'btnBrowseFolder

        '

        Me.btnBrowseFolder.Location = New System.Drawing.Point(731, 12)

        Me.btnBrowseFolder.Name = "btnBrowseFolder"

        Me.btnBrowseFolder.Size = New System.Drawing.Size(24, 20)

        Me.btnBrowseFolder.TabIndex = 1

        Me.btnBrowseFolder.Text = "..."

        Me.btnBrowseFolder.UseVisualStyleBackColor = True

        '

        'bntOpen

        '

        Me.bntOpen.Location = New System.Drawing.Point(12, 38)

        Me.bntOpen.Name = "bntOpen"

        Me.bntOpen.Size = New System.Drawing.Size(75, 23)

        Me.bntOpen.TabIndex = 2

        Me.bntOpen.Text = "Open"

        Me.bntOpen.UseVisualStyleBackColor = True

        '

        'btnClose

        '

        Me.btnClose.Location = New System.Drawing.Point(93, 38)

        Me.btnClose.Name = "btnClose"

        Me.btnClose.Size = New System.Drawing.Size(75, 23)

        Me.btnClose.TabIndex = 3

        Me.btnClose.Text = "Close"

        Me.btnClose.UseVisualStyleBackColor = True

        '

        'btnReopen

        '

        Me.btnReopen.Location = New System.Drawing.Point(174, 38)

        Me.btnReopen.Name = "btnReopen"

        Me.btnReopen.Size = New System.Drawing.Size(75, 23)

        Me.btnReopen.TabIndex = 4

        Me.btnReopen.Text = "Reopen"

        Me.btnReopen.UseVisualStyleBackColor = True

        '

        'btnIsCurent

        '

        Me.btnIsCurent.Location = New System.Drawing.Point(255, 38)

        Me.btnIsCurent.Name = "btnIsCurent"

        Me.btnIsCurent.Size = New System.Drawing.Size(75, 23)

        Me.btnIsCurent.TabIndex = 5

        Me.btnIsCurent.Text = "IsCurrent?"

        Me.btnIsCurent.UseVisualStyleBackColor = True

        '

        'btnSearch

        '

        Me.btnSearch.Location = New System.Drawing.Point(680, 67)

        Me.btnSearch.Name = "btnSearch"

        Me.btnSearch.Size = New System.Drawing.Size(75, 20)

        Me.btnSearch.TabIndex = 6

        Me.btnSearch.Text = "Search"

        Me.btnSearch.UseVisualStyleBackColor = True

        '

        'txtSearch

        '

        Me.txtSearch.Location = New System.Drawing.Point(12, 67)

        Me.txtSearch.Name = "txtSearch"

        Me.txtSearch.Size = New System.Drawing.Size(662, 20)

        Me.txtSearch.TabIndex = 7

        '

        'StatusStrip1

        '

        Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.statusLabel})

        Me.StatusStrip1.Location = New System.Drawing.Point(0, 375)

        Me.StatusStrip1.Name = "StatusStrip1"

        Me.StatusStrip1.Size = New System.Drawing.Size(767, 22)

        Me.StatusStrip1.TabIndex = 8

        Me.StatusStrip1.Text = "StatusStrip1"

        '

        'statusLabel

        '

        Me.statusLabel.Name = "statusLabel"

        Me.statusLabel.Size = New System.Drawing.Size(111, 17)

        Me.statusLabel.Text = "ToolStripStatusLabel1"

        '

        'btnAdd

        '

        Me.btnAdd.Location = New System.Drawing.Point(336, 38)

        Me.btnAdd.Name = "btnAdd"

        Me.btnAdd.Size = New System.Drawing.Size(75, 23)

        Me.btnAdd.TabIndex = 9

        Me.btnAdd.Text = "Add doc"

        Me.btnAdd.UseVisualStyleBackColor = True

        '

        'Form1

        '

        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

        Me.ClientSize = New System.Drawing.Size(767, 397)

        Me.Controls.Add(Me.btnAdd)

        Me.Controls.Add(Me.StatusStrip1)

        Me.Controls.Add(Me.txtSearch)

        Me.Controls.Add(Me.btnSearch)

        Me.Controls.Add(Me.btnIsCurent)

        Me.Controls.Add(Me.btnReopen)

        Me.Controls.Add(Me.btnClose)

        Me.Controls.Add(Me.bntOpen)

        Me.Controls.Add(Me.btnBrowseFolder)

        Me.Controls.Add(Me.txtIndexFolder)

        Me.Name = "Form1"

        Me.Text = "Form1"

        Me.StatusStrip1.ResumeLayout(False)

        Me.StatusStrip1.PerformLayout()

        Me.ResumeLayout(False)

        Me.PerformLayout()

 

    End Sub

    Friend WithEvents txtIndexFolder As System.Windows.Forms.TextBox

    Friend WithEvents btnBrowseFolder As System.Windows.Forms.Button

    Friend WithEvents bntOpen As System.Windows.Forms.Button

    Friend WithEvents btnClose As System.Windows.Forms.Button

    Friend WithEvents btnReopen As System.Windows.Forms.Button

    Friend WithEvents btnIsCurent As System.Windows.Forms.Button

    Friend WithEvents btnSearch As System.Windows.Forms.Button

    Friend WithEvents txtSearch As System.Windows.Forms.TextBox

    Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip

    Friend WithEvents statusLabel As System.Windows.Forms.ToolStripStatusLabel

    Friend WithEvents btnAdd As System.Windows.Forms.Button

 

 

    Private _ir As IndexReader

    Private _is As IndexSearcher

 

    Private Sub btnBrowseFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseFolder.Click

        Using ofd As New FolderBrowserDialog

            ofd.SelectedPath = txtIndexFolder.Text

 

            If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then

                txtIndexFolder.Text = ofd.SelectedPath

            End If

        End Using

    End Sub

 

    Private Sub bntOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntOpen.Click

        Dim sDir As String = txtIndexFolder.Text.Trim

        If sDir = "" OrElse IO.Directory.Exists(sDir) = False Then

            MessageBox.Show("Select the index directory.")

            Exit Sub

        End If

 

        Try

            _ir.EnsureOpen()

            MessageBox.Show("Reader is already open.")

            Exit Sub

        Catch ex As Exception

            ' Reader is not open,    continue

        End Try

 

        _ir = IndexReader.Open(sDir)

        _is = New IndexSearcher(sDir)

        statusLabel.Text = "Index open."

    End Sub

 

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        _ir.Close()

        _is.Close()

        statusLabel.Text = "Index closed"

    End Sub

 

    Private Sub btnReopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReopen.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        Dim newR As IndexReader

        Dim newSR As IndexReader

        Try

            newR = _ir.Reopen

            If newR IsNot _ir Then

                ' READER

                ' Store a reference to the old reader to close it later

                Try

                    _ir.Close()

                Catch

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Set Reader to the new reopened instance

                _ir = newR

            End If

 

            newSR = _is.Reader.Reopen

            If newSR IsNot _is.Reader Then

                ' SEARCHER

                Try

                    ' We dont need this since we created the Searcher with a string "c:\asdasfd\"

                    '_is.Reader.Close 

                    _is.Close()

                Catch ex As Exception

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Create a new Searcher using the reopened reader

                _is = New IndexSearcher(newSR)

            End If

        Catch ex As Exception

            MessageBox.Show("Error reopening index: " + ex.Message)

        End Try

    End Sub

 

    Private Sub btnIsCurent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIsCurent.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Try

            MessageBox.Show("Reader is current=" + _ir.IsCurrent.ToString)

            MessageBox.Show("Searcher is current=" + _is.Reader.IsCurrent.ToString)

        Catch ex As Exception

            MessageBox.Show("ERROR gettings IsCurrent: " + ex.Message + vbCrLf + ex.ToString)

        End Try

    End Sub

 

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

        If txtSearch.Text.Trim <> "" Then

            Dim qp As New Lucene.Net.QueryParsers.QueryParser("", New Lucene.Net.Analysis.WhitespaceAnalyzer())

            Dim q As Query = qp.Parse(txtSearch.Text)

            Dim topD As Lucene.Net.Search.TopDocs = _is.Search(q, 100)

        End If

    End Sub

 

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Dim _iw As IndexWriter

        Try

            _iw = New IndexWriter(txtIndexFolder.Text, New Lucene.Net.Analysis.WhitespaceAnalyzer(), False, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED)

            Dim d As New Lucene.Net.Documents.Document()

            Dim f As New Lucene.Net.Documents.Field("fieldName", "fieldValue", Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.ANALYZED)

            d.Add(f)

            _iw.AddDocument(d)

            _iw.Commit()

        Catch ex As Exception

            MessageBox.Show("Error: " + ex.Message + vbCrLf + ex.ToString)

        Finally

            If _iw IsNot Nothing Then

                _iw.Close()

            End If

        End Try

    End Sub

 

End Class

=======================================================

 

Saludos,

Luis

 

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 5:04 PM

To: 'lucene-net-dev@incubator.apache.org'

Subject: RE: Port of Java Lucene 2.9 is under way

 

Just to confirm I've just downloaded the version in the trunk and it’s the same version I have in my environment.

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 3:55 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi Michael

 

I'm not sure if I have latest version from the trunk. I'll check that right now.

 

The error is:

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246

   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235

   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491

   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"

 

 

>From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.

And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

 

I'll try to write a function to reproduce the problem.

 

Thanks in advance for your help.

 

Saludos, 

Luis

 

-----Original Message-----

From: Michael Garski [mailto:mgarski@myspace-inc.com] 

Sent: Thursday, October 15, 2009 12:42 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Luis,

 

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

 

Michael

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 

Sent: Wednesday, October 14, 2009 7:13 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi George

 

I just want to know the status of the 2.9 port.

 

I'm thinking of trying it because we are using 2.4 and I think we are

hitting a bug with the Reopen method.

I was looking for a solution and found a thread in the Java JIRA that says

the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with

a patch:

https://issues.apache.org/jira/browse/LUCENE-1453

 

The reopen function is very important for us because we update the index

very often, and right now we have to Close + Open each time we update the

index, and because we use custom sort field, we also need to warm up each

time we Close+Open, and all that seems to be solved with the Reopen. 

 

Thanks

 

Best regards

Luis

 

-----Original Message-----

From: George Aroush [mailto:george@aroush.net] 

Sent: Wednesday, September 16, 2009 9:32 PM

To: lucene-net-dev@incubator.apache.org;

lucene-net-user@incubator.apache.org

Subject: Port of Java Lucene 2.9 is under way

 

Hi folks,

 

 

 

This is to let you know that I have begun the porting process of Java Lucene

2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an

early release checked-into SVN.

 

 

 

If you are following Java Lucene mailing list, you will know that 2.9 is

currently undergoing release as Release Candidate 4 and RC5 is expected (a

bug was found in RC4).  My port is based on RC3, but changes between Java

Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

 

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net

releases very close; my hope is, any further ports should be an accumulation

of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk

release.  I'm not sure if this goal can be achieved, but we will see.

 

 

 

Regards,

 

 

 

-- George

 

 

 

 

 




RE: Port of Java Lucene 2.9 is under way

Posted by "Luis Fco. Ramirez Daza Gonzalez" <lu...@yahoo.com.mx>.
Hi all

Well after hours of debugging my app I have a headache.
I found the problem. The new code is below. If someone can just get it and test please I'll appreciate very much.

The problem does not happen with the Search, search is working OK. But if you call IsCurrent the error occurs.
If you run the code, if you mark the checkbox "Force error" the exception will occur if you.
1.- Open de index;   
2.- Get IsCurrent  <<--OK, NO error;  
3.- Click Search <<-- OK, NO ERROR;  
4.- Add a document;   
5.- Reopen index;   
6.- Get IsCurrent  <<--ERROR;  
7.- Click Search <<-- OK, NO ERROR;  

If you run the code, if you left the checkbox "Force error" unchecked then there is no error, you can search, append doc, reopen, get IsCurrent, and all works.

The error depends on how you open the IndexReader.
If chkForceError.Checked Then  
     _ir = IndexReader.Open(sDir)    '<< ERROR is you pass a string
Else
     Dim d As FSDirectory = FSDirectory.GetDirectory(New IO.FileInfo(sDir))
     _ir = IndexReader.Open(d)       '<< NO error, if you pass a directory (FSDirectory in this case)
End If
_is = New IndexSearcher(_ir)


Saludos,
  - Luis
======= CODE =============================================================
Imports Lucene.Net.Index
Imports Lucene.Net.Search
Imports Lucene.Net.Store

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub
    Friend WithEvents chkForceError As System.Windows.Forms.CheckBox
    Friend WithEvents btnCreateIndex As System.Windows.Forms.Button

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.txtIndexFolder = New System.Windows.Forms.TextBox
        Me.btnBrowseFolder = New System.Windows.Forms.Button
        Me.bntOpen = New System.Windows.Forms.Button
        Me.btnClose = New System.Windows.Forms.Button
        Me.btnReopen = New System.Windows.Forms.Button
        Me.btnIsCurent = New System.Windows.Forms.Button
        Me.btnSearch = New System.Windows.Forms.Button
        Me.txtSearch = New System.Windows.Forms.TextBox
        Me.StatusStrip1 = New System.Windows.Forms.StatusStrip
        Me.statusLabel = New System.Windows.Forms.ToolStripStatusLabel
        Me.btnAdd = New System.Windows.Forms.Button
        Me.chkForceError = New System.Windows.Forms.CheckBox
        Me.btnCreateIndex = New System.Windows.Forms.Button
        Me.StatusStrip1.SuspendLayout()
        Me.SuspendLayout()
        '
        'txtIndexFolder
        '
        Me.txtIndexFolder.Location = New System.Drawing.Point(12, 12)
        Me.txtIndexFolder.Name = "txtIndexFolder"
        Me.txtIndexFolder.Size = New System.Drawing.Size(713, 20)
        Me.txtIndexFolder.TabIndex = 0
        Me.txtIndexFolder.Text = "C:\retrdata\WORKS_REPLICATION\WMIN_ORIG\WMIN\Indexes\Index"
        '
        'btnBrowseFolder
        '
        Me.btnBrowseFolder.Location = New System.Drawing.Point(731, 12)
        Me.btnBrowseFolder.Name = "btnBrowseFolder"
        Me.btnBrowseFolder.Size = New System.Drawing.Size(24, 20)
        Me.btnBrowseFolder.TabIndex = 1
        Me.btnBrowseFolder.Text = "..."
        Me.btnBrowseFolder.UseVisualStyleBackColor = True
        '
        'bntOpen
        '
        Me.bntOpen.Location = New System.Drawing.Point(12, 38)
        Me.bntOpen.Name = "bntOpen"
        Me.bntOpen.Size = New System.Drawing.Size(75, 23)
        Me.bntOpen.TabIndex = 2
        Me.bntOpen.Text = "Open"
        Me.bntOpen.UseVisualStyleBackColor = True
        '
        'btnClose
        '
        Me.btnClose.Location = New System.Drawing.Point(270, 38)
        Me.btnClose.Name = "btnClose"
        Me.btnClose.Size = New System.Drawing.Size(75, 23)
        Me.btnClose.TabIndex = 3
        Me.btnClose.Text = "Close"
        Me.btnClose.UseVisualStyleBackColor = True
        '
        'btnReopen
        '
        Me.btnReopen.Location = New System.Drawing.Point(351, 38)
        Me.btnReopen.Name = "btnReopen"
        Me.btnReopen.Size = New System.Drawing.Size(75, 23)
        Me.btnReopen.TabIndex = 4
        Me.btnReopen.Text = "Reopen"
        Me.btnReopen.UseVisualStyleBackColor = True
        '
        'btnIsCurent
        '
        Me.btnIsCurent.Location = New System.Drawing.Point(432, 38)
        Me.btnIsCurent.Name = "btnIsCurent"
        Me.btnIsCurent.Size = New System.Drawing.Size(75, 23)
        Me.btnIsCurent.TabIndex = 5
        Me.btnIsCurent.Text = "IsCurrent?"
        Me.btnIsCurent.UseVisualStyleBackColor = True
        '
        'btnSearch
        '
        Me.btnSearch.Location = New System.Drawing.Point(680, 67)
        Me.btnSearch.Name = "btnSearch"
        Me.btnSearch.Size = New System.Drawing.Size(75, 20)
        Me.btnSearch.TabIndex = 6
        Me.btnSearch.Text = "Search"
        Me.btnSearch.UseVisualStyleBackColor = True
        '
        'txtSearch
        '
        Me.txtSearch.Location = New System.Drawing.Point(12, 67)
        Me.txtSearch.Name = "txtSearch"
        Me.txtSearch.Size = New System.Drawing.Size(662, 20)
        Me.txtSearch.TabIndex = 7
        Me.txtSearch.Text = "fieldName:fieldValue"
        '
        'StatusStrip1
        '
        Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.statusLabel})
        Me.StatusStrip1.Location = New System.Drawing.Point(0, 375)
        Me.StatusStrip1.Name = "StatusStrip1"
        Me.StatusStrip1.Size = New System.Drawing.Size(843, 22)
        Me.StatusStrip1.TabIndex = 8
        Me.StatusStrip1.Text = "StatusStrip1"
        '
        'statusLabel
        '
        Me.statusLabel.Name = "statusLabel"
        Me.statusLabel.Size = New System.Drawing.Size(111, 17)
        Me.statusLabel.Text = "ToolStripStatusLabel1"
        '
        'btnAdd
        '
        Me.btnAdd.Location = New System.Drawing.Point(513, 38)
        Me.btnAdd.Name = "btnAdd"
        Me.btnAdd.Size = New System.Drawing.Size(75, 23)
        Me.btnAdd.TabIndex = 9
        Me.btnAdd.Text = "Add doc"
        Me.btnAdd.UseVisualStyleBackColor = True
        '
        'chkForceError
        '
        Me.chkForceError.AutoSize = True
        Me.chkForceError.Location = New System.Drawing.Point(94, 43)
        Me.chkForceError.Name = "chkForceError"
        Me.chkForceError.Size = New System.Drawing.Size(77, 17)
        Me.chkForceError.TabIndex = 10
        Me.chkForceError.Text = "Force error"
        Me.chkForceError.UseVisualStyleBackColor = True
        '
        'btnCreateIndex
        '
        Me.btnCreateIndex.Location = New System.Drawing.Point(761, 12)
        Me.btnCreateIndex.Name = "btnCreateIndex"
        Me.btnCreateIndex.Size = New System.Drawing.Size(75, 20)
        Me.btnCreateIndex.TabIndex = 11
        Me.btnCreateIndex.Text = "Create"
        Me.btnCreateIndex.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(843, 397)
        Me.Controls.Add(Me.btnCreateIndex)
        Me.Controls.Add(Me.chkForceError)
        Me.Controls.Add(Me.btnAdd)
        Me.Controls.Add(Me.StatusStrip1)
        Me.Controls.Add(Me.txtSearch)
        Me.Controls.Add(Me.btnSearch)
        Me.Controls.Add(Me.btnIsCurent)
        Me.Controls.Add(Me.btnReopen)
        Me.Controls.Add(Me.btnClose)
        Me.Controls.Add(Me.bntOpen)
        Me.Controls.Add(Me.btnBrowseFolder)
        Me.Controls.Add(Me.txtIndexFolder)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.StatusStrip1.ResumeLayout(False)
        Me.StatusStrip1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents txtIndexFolder As System.Windows.Forms.TextBox
    Friend WithEvents btnBrowseFolder As System.Windows.Forms.Button
    Friend WithEvents bntOpen As System.Windows.Forms.Button
    Friend WithEvents btnClose As System.Windows.Forms.Button
    Friend WithEvents btnReopen As System.Windows.Forms.Button
    Friend WithEvents btnIsCurent As System.Windows.Forms.Button
    Friend WithEvents btnSearch As System.Windows.Forms.Button
    Friend WithEvents txtSearch As System.Windows.Forms.TextBox
    Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip
    Friend WithEvents statusLabel As System.Windows.Forms.ToolStripStatusLabel
    Friend WithEvents btnAdd As System.Windows.Forms.Button


    Private _ir As IndexReader
    Private _is As IndexSearcher

    Private Sub btnBrowseFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseFolder.Click
        Using ofd As New FolderBrowserDialog
            ofd.SelectedPath = txtIndexFolder.Text

            If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
                txtIndexFolder.Text = ofd.SelectedPath
            End If
        End Using
    End Sub

    Private Sub bntOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntOpen.Click
        Dim sDir As String = txtIndexFolder.Text.Trim
        If sDir = "" OrElse IO.Directory.Exists(sDir) = False Then
            MessageBox.Show("Select the index directory.")
            Exit Sub
        End If

        Try
            _ir.EnsureOpen()
            MessageBox.Show("Reader is already open.")
            Exit Sub
        Catch ex As Exception
            ' Reader is not open,    continue
        End Try

        If chkForceError.Checked Then
            _ir = IndexReader.Open(sDir)
        Else
            Dim d As FSDirectory = FSDirectory.GetDirectory(New IO.FileInfo(sDir))
            _ir = IndexReader.Open(d)
        End If
        _is = New IndexSearcher(_ir)
        statusLabel.Text = "Index open."
    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Try
            _ir.EnsureOpen()
        Catch ex As Exception
            MessageBox.Show("Reader is closed.")
            Exit Sub
        End Try
        _ir.Close()
        ' No need to close searcher becuase the Searcher.Reader is _is and is closed
        '_is.close()
        statusLabel.Text = "Index closed"
    End Sub

    Private Sub btnReopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReopen.Click
        Try
            _ir.EnsureOpen()
        Catch ex As Exception
            MessageBox.Show("Reader is closed.")
            Exit Sub
        End Try

        Dim newR As IndexReader
        Dim newSR As IndexReader
        Try
            newR = _ir.Reopen
            If newR IsNot _ir Then
                Try
                    _ir.Close()
                Catch ex As Exception
                    ' do Nothing, just in case its already closed an exception can occur
                    MessageBox.Show(ex.ToString)
                End Try

                ' Set Reader to the new reopened instance
                _ir = newR

                ' No need to close because _ir is already closed
                '_is.reader.close()
                '_is.close()

                ' Create a new Searcher using the reopened reader
                _is = New IndexSearcher(_ir)
            End If
        Catch ex As Exception
            MessageBox.Show("Error reopening index: " + ex.Message)
        End Try
    End Sub

    Private Sub btnIsCurent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIsCurent.Click
        Try
            _ir.EnsureOpen()
        Catch ex As Exception
            MessageBox.Show("Reader is closed.")
            Exit Sub
        End Try
        Try
            MessageBox.Show("Reader is current=" + _ir.IsCurrent.ToString)
            MessageBox.Show("Searcher is current=" + _is.Reader.IsCurrent.ToString)
        Catch ex As Exception
            MessageBox.Show("ERROR gettings IsCurrent: " + ex.Message + vbCrLf + ex.ToString)
        End Try
    End Sub

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        If txtSearch.Text.Trim <> "" Then
            Dim qp As New Lucene.Net.QueryParsers.QueryParser("", New Lucene.Net.Analysis.WhitespaceAnalyzer())
            Dim q As Query = qp.Parse(txtSearch.Text)
            Dim topD As Lucene.Net.Search.TopDocs = _is.Search(q, 100)
            MessageBox.Show("Record count= " + topD.totalHits.ToString)
        End If
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        Try
            _ir.EnsureOpen()
        Catch ex As Exception
            MessageBox.Show("Reader is closed.")
            Exit Sub
        End Try
        Dim _iw As IndexWriter
        Try
            _iw = New IndexWriter(txtIndexFolder.Text, New Lucene.Net.Analysis.WhitespaceAnalyzer(), False, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED)
            Dim d As New Lucene.Net.Documents.Document()
            Dim f As New Lucene.Net.Documents.Field("fieldName", "fieldValue", Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.ANALYZED)
            d.Add(f)
            _iw.AddDocument(d)
            _iw.Commit()
        Catch ex As Exception
            MessageBox.Show("Error: " + ex.Message + vbCrLf + ex.ToString)
        Finally
            If _iw IsNot Nothing Then
                _iw.Close()
            End If
        End Try
    End Sub

    Private Sub btnCreateIndex_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateIndex.Click
        Dim sDir As String = txtIndexFolder.Text.Trim
        If sDir = "" OrElse IO.Directory.Exists(sDir) = False Then
            MessageBox.Show("Select the index directory.")
            Exit Sub
        End If
        Dim aFiles() As String = IO.Directory.GetFiles(sDir)
        If aFiles IsNot Nothing AndAlso aFiles.Length > 0 Then
            If MessageBox.Show("Folder contain some files. Are you sure you want to create the index in this folder?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
                Exit Sub
            End If
        End If
        Try
            Dim iw As IndexWriter = New IndexWriter(sDir, New Lucene.Net.Analysis.WhitespaceAnalyzer, True, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED)
            iw.Close()
        Catch ex As Exception
            MessageBox.Show("ERROR: " + ex.ToString)
        End Try
    End Sub

End Class
======= CODE =============================================================




-----Original Message-----
From: Digy [mailto:digydigy@gmail.com] 
Sent: Friday, October 16, 2009 4:54 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Additionally,
>> Or that means that I can use a single Reader to open different instances of IndexSearcher and close an IndexSearcher without affecting the other Searcher instances?

You can use a single instance of IndexSearcher across queries and across threads in your application.

DIGY

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Friday, October 16, 2009 8:27 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Digy

Thanks for your help.

I have a question here.
I use the reader for other tasks, and later in my code the reader (_ir) is closed, and I just keep open the searcher. Or sometimes viceversa, I close the searcher and just keep the Reader open.
If I use a single Reader on both instances(_ir and _is), what happens if I close either one or the other? Wouldn’t the other one be closed too? 
Or that means that I can use a single Reader to open different instances of IndexSearcher and close an IndexSearcher without affecting the other Searcher instances?

Best regards
Luis

-----Original Message-----
From: Digy [mailto:digydigy@gmail.com] 
Sent: Friday, October 16, 2009 12:03 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Luis,

 

I think, you shouldn't reopen "_is.Reader". Just create a new IndexSearcher with the new "_ir".

Your code(converted to c#) is below. See the comments.

 

            IndexReader newR = _ir.Reopen();

            if (newR != _ir)

            {

                _ir.Close();

            }

            _ir = newR;

 

            //REMOVED

            //IndexReader newSR = _is.Reader.Reopen();

            //if (newSR != _is.Reader)

            //{

            //    _is.Close();

            //}

            //_is = new IndexSearcher(newSR);

            _is = new IndexSearcher(_ir); //<--ADDED

 

DIGY

 

 

 

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Friday, October 16, 2009 6:49 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi all

 

I've just created a new test project and I confirm that the exception occurs.

 

The steps to reproduce:

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Reopen Searcer and/or Reader. (Click "Reopen" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: 

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\Directory.cs:line 244

   at Lucene.Net.Store.FSDirectory.List() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\FSDirectory.cs:line 386

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 620

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 473

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\DirectoryIndexReader.cs:line 232

   at LuceneReopenTest.Form1.btnIsCurent_Click(Object sender, EventArgs e) in G:\Installers\Desarrollo\LuceneNET\Tests\LuceneReopenTest\LuceneReopenTest\Form1.vb:line 268"

 

If instead of using Reopen you do a Close + Open, there is no exception.

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Close+Open Searcer and/or Reader. (Click "Close" then the "Open" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: TRUE    :-)

 

My test project code is below. It is just a VB project with a single form.

Just create a new form, delete the "Form1.Designer.vb" file and paste the code in the "Form1.vb".

=======================================================

Imports Lucene.Net.Index

Imports Lucene.Net.Search

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Class Form1

    Inherits System.Windows.Forms.Form

 

    'Form overrides dispose to clean up the component list.

    <System.Diagnostics.DebuggerNonUserCode()> _

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

        Try

            If disposing AndAlso components IsNot Nothing Then

                components.Dispose()

            End If

        Finally

            MyBase.Dispose(disposing)

        End Try

    End Sub

 

    'Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

 

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer.  

    'Do not modify it using the code editor.

    <System.Diagnostics.DebuggerStepThrough()> _

    Private Sub InitializeComponent()

        Me.txtIndexFolder = New System.Windows.Forms.TextBox

        Me.btnBrowseFolder = New System.Windows.Forms.Button

        Me.bntOpen = New System.Windows.Forms.Button

        Me.btnClose = New System.Windows.Forms.Button

        Me.btnReopen = New System.Windows.Forms.Button

        Me.btnIsCurent = New System.Windows.Forms.Button

        Me.btnSearch = New System.Windows.Forms.Button

        Me.txtSearch = New System.Windows.Forms.TextBox

        Me.StatusStrip1 = New System.Windows.Forms.StatusStrip

        Me.statusLabel = New System.Windows.Forms.ToolStripStatusLabel

        Me.btnAdd = New System.Windows.Forms.Button

        Me.StatusStrip1.SuspendLayout()

        Me.SuspendLayout()

        '

        'txtIndexFolder

        '

        Me.txtIndexFolder.Location = New System.Drawing.Point(12, 12)

        Me.txtIndexFolder.Name = "txtIndexFolder"

        Me.txtIndexFolder.Size = New System.Drawing.Size(713, 20)

        Me.txtIndexFolder.TabIndex = 0

        '

        'btnBrowseFolder

        '

        Me.btnBrowseFolder.Location = New System.Drawing.Point(731, 12)

        Me.btnBrowseFolder.Name = "btnBrowseFolder"

        Me.btnBrowseFolder.Size = New System.Drawing.Size(24, 20)

        Me.btnBrowseFolder.TabIndex = 1

        Me.btnBrowseFolder.Text = "..."

        Me.btnBrowseFolder.UseVisualStyleBackColor = True

        '

        'bntOpen

        '

        Me.bntOpen.Location = New System.Drawing.Point(12, 38)

        Me.bntOpen.Name = "bntOpen"

        Me.bntOpen.Size = New System.Drawing.Size(75, 23)

        Me.bntOpen.TabIndex = 2

        Me.bntOpen.Text = "Open"

        Me.bntOpen.UseVisualStyleBackColor = True

        '

        'btnClose

        '

        Me.btnClose.Location = New System.Drawing.Point(93, 38)

        Me.btnClose.Name = "btnClose"

        Me.btnClose.Size = New System.Drawing.Size(75, 23)

        Me.btnClose.TabIndex = 3

        Me.btnClose.Text = "Close"

        Me.btnClose.UseVisualStyleBackColor = True

        '

        'btnReopen

        '

        Me.btnReopen.Location = New System.Drawing.Point(174, 38)

        Me.btnReopen.Name = "btnReopen"

        Me.btnReopen.Size = New System.Drawing.Size(75, 23)

        Me.btnReopen.TabIndex = 4

        Me.btnReopen.Text = "Reopen"

        Me.btnReopen.UseVisualStyleBackColor = True

        '

        'btnIsCurent

        '

        Me.btnIsCurent.Location = New System.Drawing.Point(255, 38)

        Me.btnIsCurent.Name = "btnIsCurent"

        Me.btnIsCurent.Size = New System.Drawing.Size(75, 23)

        Me.btnIsCurent.TabIndex = 5

        Me.btnIsCurent.Text = "IsCurrent?"

        Me.btnIsCurent.UseVisualStyleBackColor = True

        '

        'btnSearch

        '

        Me.btnSearch.Location = New System.Drawing.Point(680, 67)

        Me.btnSearch.Name = "btnSearch"

        Me.btnSearch.Size = New System.Drawing.Size(75, 20)

        Me.btnSearch.TabIndex = 6

        Me.btnSearch.Text = "Search"

        Me.btnSearch.UseVisualStyleBackColor = True

        '

        'txtSearch

        '

        Me.txtSearch.Location = New System.Drawing.Point(12, 67)

        Me.txtSearch.Name = "txtSearch"

        Me.txtSearch.Size = New System.Drawing.Size(662, 20)

        Me.txtSearch.TabIndex = 7

        '

        'StatusStrip1

        '

        Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.statusLabel})

        Me.StatusStrip1.Location = New System.Drawing.Point(0, 375)

        Me.StatusStrip1.Name = "StatusStrip1"

        Me.StatusStrip1.Size = New System.Drawing.Size(767, 22)

        Me.StatusStrip1.TabIndex = 8

        Me.StatusStrip1.Text = "StatusStrip1"

        '

        'statusLabel

        '

        Me.statusLabel.Name = "statusLabel"

        Me.statusLabel.Size = New System.Drawing.Size(111, 17)

        Me.statusLabel.Text = "ToolStripStatusLabel1"

        '

        'btnAdd

        '

        Me.btnAdd.Location = New System.Drawing.Point(336, 38)

        Me.btnAdd.Name = "btnAdd"

        Me.btnAdd.Size = New System.Drawing.Size(75, 23)

        Me.btnAdd.TabIndex = 9

        Me.btnAdd.Text = "Add doc"

        Me.btnAdd.UseVisualStyleBackColor = True

        '

        'Form1

        '

        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

        Me.ClientSize = New System.Drawing.Size(767, 397)

        Me.Controls.Add(Me.btnAdd)

        Me.Controls.Add(Me.StatusStrip1)

        Me.Controls.Add(Me.txtSearch)

        Me.Controls.Add(Me.btnSearch)

        Me.Controls.Add(Me.btnIsCurent)

        Me.Controls.Add(Me.btnReopen)

        Me.Controls.Add(Me.btnClose)

        Me.Controls.Add(Me.bntOpen)

        Me.Controls.Add(Me.btnBrowseFolder)

        Me.Controls.Add(Me.txtIndexFolder)

        Me.Name = "Form1"

        Me.Text = "Form1"

        Me.StatusStrip1.ResumeLayout(False)

        Me.StatusStrip1.PerformLayout()

        Me.ResumeLayout(False)

        Me.PerformLayout()

 

    End Sub

    Friend WithEvents txtIndexFolder As System.Windows.Forms.TextBox

    Friend WithEvents btnBrowseFolder As System.Windows.Forms.Button

    Friend WithEvents bntOpen As System.Windows.Forms.Button

    Friend WithEvents btnClose As System.Windows.Forms.Button

    Friend WithEvents btnReopen As System.Windows.Forms.Button

    Friend WithEvents btnIsCurent As System.Windows.Forms.Button

    Friend WithEvents btnSearch As System.Windows.Forms.Button

    Friend WithEvents txtSearch As System.Windows.Forms.TextBox

    Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip

    Friend WithEvents statusLabel As System.Windows.Forms.ToolStripStatusLabel

    Friend WithEvents btnAdd As System.Windows.Forms.Button

 

 

    Private _ir As IndexReader

    Private _is As IndexSearcher

 

    Private Sub btnBrowseFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseFolder.Click

        Using ofd As New FolderBrowserDialog

            ofd.SelectedPath = txtIndexFolder.Text

 

            If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then

                txtIndexFolder.Text = ofd.SelectedPath

            End If

        End Using

    End Sub

 

    Private Sub bntOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntOpen.Click

        Dim sDir As String = txtIndexFolder.Text.Trim

        If sDir = "" OrElse IO.Directory.Exists(sDir) = False Then

            MessageBox.Show("Select the index directory.")

            Exit Sub

        End If

 

        Try

            _ir.EnsureOpen()

            MessageBox.Show("Reader is already open.")

            Exit Sub

        Catch ex As Exception

            ' Reader is not open,    continue

        End Try

 

        _ir = IndexReader.Open(sDir)

        _is = New IndexSearcher(sDir)

        statusLabel.Text = "Index open."

    End Sub

 

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        _ir.Close()

        _is.Close()

        statusLabel.Text = "Index closed"

    End Sub

 

    Private Sub btnReopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReopen.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        Dim newR As IndexReader

        Dim newSR As IndexReader

        Try

            newR = _ir.Reopen

            If newR IsNot _ir Then

                ' READER

                ' Store a reference to the old reader to close it later

                Try

                    _ir.Close()

                Catch

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Set Reader to the new reopened instance

                _ir = newR

            End If

 

            newSR = _is.Reader.Reopen

            If newSR IsNot _is.Reader Then

                ' SEARCHER

                Try

                    ' We dont need this since we created the Searcher with a string "c:\asdasfd\"

                    '_is.Reader.Close 

                    _is.Close()

                Catch ex As Exception

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Create a new Searcher using the reopened reader

                _is = New IndexSearcher(newSR)

            End If

        Catch ex As Exception

            MessageBox.Show("Error reopening index: " + ex.Message)

        End Try

    End Sub

 

    Private Sub btnIsCurent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIsCurent.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Try

            MessageBox.Show("Reader is current=" + _ir.IsCurrent.ToString)

            MessageBox.Show("Searcher is current=" + _is.Reader.IsCurrent.ToString)

        Catch ex As Exception

            MessageBox.Show("ERROR gettings IsCurrent: " + ex.Message + vbCrLf + ex.ToString)

        End Try

    End Sub

 

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

        If txtSearch.Text.Trim <> "" Then

            Dim qp As New Lucene.Net.QueryParsers.QueryParser("", New Lucene.Net.Analysis.WhitespaceAnalyzer())

            Dim q As Query = qp.Parse(txtSearch.Text)

            Dim topD As Lucene.Net.Search.TopDocs = _is.Search(q, 100)

        End If

    End Sub

 

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Dim _iw As IndexWriter

        Try

            _iw = New IndexWriter(txtIndexFolder.Text, New Lucene.Net.Analysis.WhitespaceAnalyzer(), False, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED)

            Dim d As New Lucene.Net.Documents.Document()

            Dim f As New Lucene.Net.Documents.Field("fieldName", "fieldValue", Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.ANALYZED)

            d.Add(f)

            _iw.AddDocument(d)

            _iw.Commit()

        Catch ex As Exception

            MessageBox.Show("Error: " + ex.Message + vbCrLf + ex.ToString)

        Finally

            If _iw IsNot Nothing Then

                _iw.Close()

            End If

        End Try

    End Sub

 

End Class

=======================================================

 

Saludos,

Luis

 

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 5:04 PM

To: 'lucene-net-dev@incubator.apache.org'

Subject: RE: Port of Java Lucene 2.9 is under way

 

Just to confirm I've just downloaded the version in the trunk and it’s the same version I have in my environment.

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 3:55 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi Michael

 

I'm not sure if I have latest version from the trunk. I'll check that right now.

 

The error is:

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246

   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235

   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491

   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"

 

 

>From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.

And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

 

I'll try to write a function to reproduce the problem.

 

Thanks in advance for your help.

 

Saludos, 

Luis

 

-----Original Message-----

From: Michael Garski [mailto:mgarski@myspace-inc.com] 

Sent: Thursday, October 15, 2009 12:42 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Luis,

 

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

 

Michael

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 

Sent: Wednesday, October 14, 2009 7:13 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi George

 

I just want to know the status of the 2.9 port.

 

I'm thinking of trying it because we are using 2.4 and I think we are

hitting a bug with the Reopen method.

I was looking for a solution and found a thread in the Java JIRA that says

the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with

a patch:

https://issues.apache.org/jira/browse/LUCENE-1453

 

The reopen function is very important for us because we update the index

very often, and right now we have to Close + Open each time we update the

index, and because we use custom sort field, we also need to warm up each

time we Close+Open, and all that seems to be solved with the Reopen. 

 

Thanks

 

Best regards

Luis

 

-----Original Message-----

From: George Aroush [mailto:george@aroush.net] 

Sent: Wednesday, September 16, 2009 9:32 PM

To: lucene-net-dev@incubator.apache.org;

lucene-net-user@incubator.apache.org

Subject: Port of Java Lucene 2.9 is under way

 

Hi folks,

 

 

 

This is to let you know that I have begun the porting process of Java Lucene

2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an

early release checked-into SVN.

 

 

 

If you are following Java Lucene mailing list, you will know that 2.9 is

currently undergoing release as Release Candidate 4 and RC5 is expected (a

bug was found in RC4).  My port is based on RC3, but changes between Java

Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

 

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net

releases very close; my hope is, any further ports should be an accumulation

of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk

release.  I'm not sure if this goal can be achieved, but we will see.

 

 

 

Regards,

 

 

 

-- George

 

 

 

 

 





RE: Port of Java Lucene 2.9 is under way

Posted by Digy <di...@gmail.com>.
Additionally,
>> Or that means that I can use a single Reader to open different instances of IndexSearcher and close an IndexSearcher without affecting the other Searcher instances?

You can use a single instance of IndexSearcher across queries and across threads in your application.

DIGY

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Friday, October 16, 2009 8:27 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Digy

Thanks for your help.

I have a question here.
I use the reader for other tasks, and later in my code the reader (_ir) is closed, and I just keep open the searcher. Or sometimes viceversa, I close the searcher and just keep the Reader open.
If I use a single Reader on both instances(_ir and _is), what happens if I close either one or the other? Wouldn’t the other one be closed too? 
Or that means that I can use a single Reader to open different instances of IndexSearcher and close an IndexSearcher without affecting the other Searcher instances?

Best regards
Luis

-----Original Message-----
From: Digy [mailto:digydigy@gmail.com] 
Sent: Friday, October 16, 2009 12:03 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Luis,

 

I think, you shouldn't reopen "_is.Reader". Just create a new IndexSearcher with the new "_ir".

Your code(converted to c#) is below. See the comments.

 

            IndexReader newR = _ir.Reopen();

            if (newR != _ir)

            {

                _ir.Close();

            }

            _ir = newR;

 

            //REMOVED

            //IndexReader newSR = _is.Reader.Reopen();

            //if (newSR != _is.Reader)

            //{

            //    _is.Close();

            //}

            //_is = new IndexSearcher(newSR);

            _is = new IndexSearcher(_ir); //<--ADDED

 

DIGY

 

 

 

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Friday, October 16, 2009 6:49 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi all

 

I've just created a new test project and I confirm that the exception occurs.

 

The steps to reproduce:

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Reopen Searcer and/or Reader. (Click "Reopen" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: 

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\Directory.cs:line 244

   at Lucene.Net.Store.FSDirectory.List() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\FSDirectory.cs:line 386

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 620

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 473

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\DirectoryIndexReader.cs:line 232

   at LuceneReopenTest.Form1.btnIsCurent_Click(Object sender, EventArgs e) in G:\Installers\Desarrollo\LuceneNET\Tests\LuceneReopenTest\LuceneReopenTest\Form1.vb:line 268"

 

If instead of using Reopen you do a Close + Open, there is no exception.

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Close+Open Searcer and/or Reader. (Click "Close" then the "Open" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: TRUE    :-)

 

My test project code is below. It is just a VB project with a single form.

Just create a new form, delete the "Form1.Designer.vb" file and paste the code in the "Form1.vb".

=======================================================

Imports Lucene.Net.Index

Imports Lucene.Net.Search

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Class Form1

    Inherits System.Windows.Forms.Form

 

    'Form overrides dispose to clean up the component list.

    <System.Diagnostics.DebuggerNonUserCode()> _

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

        Try

            If disposing AndAlso components IsNot Nothing Then

                components.Dispose()

            End If

        Finally

            MyBase.Dispose(disposing)

        End Try

    End Sub

 

    'Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

 

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer.  

    'Do not modify it using the code editor.

    <System.Diagnostics.DebuggerStepThrough()> _

    Private Sub InitializeComponent()

        Me.txtIndexFolder = New System.Windows.Forms.TextBox

        Me.btnBrowseFolder = New System.Windows.Forms.Button

        Me.bntOpen = New System.Windows.Forms.Button

        Me.btnClose = New System.Windows.Forms.Button

        Me.btnReopen = New System.Windows.Forms.Button

        Me.btnIsCurent = New System.Windows.Forms.Button

        Me.btnSearch = New System.Windows.Forms.Button

        Me.txtSearch = New System.Windows.Forms.TextBox

        Me.StatusStrip1 = New System.Windows.Forms.StatusStrip

        Me.statusLabel = New System.Windows.Forms.ToolStripStatusLabel

        Me.btnAdd = New System.Windows.Forms.Button

        Me.StatusStrip1.SuspendLayout()

        Me.SuspendLayout()

        '

        'txtIndexFolder

        '

        Me.txtIndexFolder.Location = New System.Drawing.Point(12, 12)

        Me.txtIndexFolder.Name = "txtIndexFolder"

        Me.txtIndexFolder.Size = New System.Drawing.Size(713, 20)

        Me.txtIndexFolder.TabIndex = 0

        '

        'btnBrowseFolder

        '

        Me.btnBrowseFolder.Location = New System.Drawing.Point(731, 12)

        Me.btnBrowseFolder.Name = "btnBrowseFolder"

        Me.btnBrowseFolder.Size = New System.Drawing.Size(24, 20)

        Me.btnBrowseFolder.TabIndex = 1

        Me.btnBrowseFolder.Text = "..."

        Me.btnBrowseFolder.UseVisualStyleBackColor = True

        '

        'bntOpen

        '

        Me.bntOpen.Location = New System.Drawing.Point(12, 38)

        Me.bntOpen.Name = "bntOpen"

        Me.bntOpen.Size = New System.Drawing.Size(75, 23)

        Me.bntOpen.TabIndex = 2

        Me.bntOpen.Text = "Open"

        Me.bntOpen.UseVisualStyleBackColor = True

        '

        'btnClose

        '

        Me.btnClose.Location = New System.Drawing.Point(93, 38)

        Me.btnClose.Name = "btnClose"

        Me.btnClose.Size = New System.Drawing.Size(75, 23)

        Me.btnClose.TabIndex = 3

        Me.btnClose.Text = "Close"

        Me.btnClose.UseVisualStyleBackColor = True

        '

        'btnReopen

        '

        Me.btnReopen.Location = New System.Drawing.Point(174, 38)

        Me.btnReopen.Name = "btnReopen"

        Me.btnReopen.Size = New System.Drawing.Size(75, 23)

        Me.btnReopen.TabIndex = 4

        Me.btnReopen.Text = "Reopen"

        Me.btnReopen.UseVisualStyleBackColor = True

        '

        'btnIsCurent

        '

        Me.btnIsCurent.Location = New System.Drawing.Point(255, 38)

        Me.btnIsCurent.Name = "btnIsCurent"

        Me.btnIsCurent.Size = New System.Drawing.Size(75, 23)

        Me.btnIsCurent.TabIndex = 5

        Me.btnIsCurent.Text = "IsCurrent?"

        Me.btnIsCurent.UseVisualStyleBackColor = True

        '

        'btnSearch

        '

        Me.btnSearch.Location = New System.Drawing.Point(680, 67)

        Me.btnSearch.Name = "btnSearch"

        Me.btnSearch.Size = New System.Drawing.Size(75, 20)

        Me.btnSearch.TabIndex = 6

        Me.btnSearch.Text = "Search"

        Me.btnSearch.UseVisualStyleBackColor = True

        '

        'txtSearch

        '

        Me.txtSearch.Location = New System.Drawing.Point(12, 67)

        Me.txtSearch.Name = "txtSearch"

        Me.txtSearch.Size = New System.Drawing.Size(662, 20)

        Me.txtSearch.TabIndex = 7

        '

        'StatusStrip1

        '

        Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.statusLabel})

        Me.StatusStrip1.Location = New System.Drawing.Point(0, 375)

        Me.StatusStrip1.Name = "StatusStrip1"

        Me.StatusStrip1.Size = New System.Drawing.Size(767, 22)

        Me.StatusStrip1.TabIndex = 8

        Me.StatusStrip1.Text = "StatusStrip1"

        '

        'statusLabel

        '

        Me.statusLabel.Name = "statusLabel"

        Me.statusLabel.Size = New System.Drawing.Size(111, 17)

        Me.statusLabel.Text = "ToolStripStatusLabel1"

        '

        'btnAdd

        '

        Me.btnAdd.Location = New System.Drawing.Point(336, 38)

        Me.btnAdd.Name = "btnAdd"

        Me.btnAdd.Size = New System.Drawing.Size(75, 23)

        Me.btnAdd.TabIndex = 9

        Me.btnAdd.Text = "Add doc"

        Me.btnAdd.UseVisualStyleBackColor = True

        '

        'Form1

        '

        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

        Me.ClientSize = New System.Drawing.Size(767, 397)

        Me.Controls.Add(Me.btnAdd)

        Me.Controls.Add(Me.StatusStrip1)

        Me.Controls.Add(Me.txtSearch)

        Me.Controls.Add(Me.btnSearch)

        Me.Controls.Add(Me.btnIsCurent)

        Me.Controls.Add(Me.btnReopen)

        Me.Controls.Add(Me.btnClose)

        Me.Controls.Add(Me.bntOpen)

        Me.Controls.Add(Me.btnBrowseFolder)

        Me.Controls.Add(Me.txtIndexFolder)

        Me.Name = "Form1"

        Me.Text = "Form1"

        Me.StatusStrip1.ResumeLayout(False)

        Me.StatusStrip1.PerformLayout()

        Me.ResumeLayout(False)

        Me.PerformLayout()

 

    End Sub

    Friend WithEvents txtIndexFolder As System.Windows.Forms.TextBox

    Friend WithEvents btnBrowseFolder As System.Windows.Forms.Button

    Friend WithEvents bntOpen As System.Windows.Forms.Button

    Friend WithEvents btnClose As System.Windows.Forms.Button

    Friend WithEvents btnReopen As System.Windows.Forms.Button

    Friend WithEvents btnIsCurent As System.Windows.Forms.Button

    Friend WithEvents btnSearch As System.Windows.Forms.Button

    Friend WithEvents txtSearch As System.Windows.Forms.TextBox

    Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip

    Friend WithEvents statusLabel As System.Windows.Forms.ToolStripStatusLabel

    Friend WithEvents btnAdd As System.Windows.Forms.Button

 

 

    Private _ir As IndexReader

    Private _is As IndexSearcher

 

    Private Sub btnBrowseFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseFolder.Click

        Using ofd As New FolderBrowserDialog

            ofd.SelectedPath = txtIndexFolder.Text

 

            If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then

                txtIndexFolder.Text = ofd.SelectedPath

            End If

        End Using

    End Sub

 

    Private Sub bntOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntOpen.Click

        Dim sDir As String = txtIndexFolder.Text.Trim

        If sDir = "" OrElse IO.Directory.Exists(sDir) = False Then

            MessageBox.Show("Select the index directory.")

            Exit Sub

        End If

 

        Try

            _ir.EnsureOpen()

            MessageBox.Show("Reader is already open.")

            Exit Sub

        Catch ex As Exception

            ' Reader is not open,    continue

        End Try

 

        _ir = IndexReader.Open(sDir)

        _is = New IndexSearcher(sDir)

        statusLabel.Text = "Index open."

    End Sub

 

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        _ir.Close()

        _is.Close()

        statusLabel.Text = "Index closed"

    End Sub

 

    Private Sub btnReopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReopen.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        Dim newR As IndexReader

        Dim newSR As IndexReader

        Try

            newR = _ir.Reopen

            If newR IsNot _ir Then

                ' READER

                ' Store a reference to the old reader to close it later

                Try

                    _ir.Close()

                Catch

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Set Reader to the new reopened instance

                _ir = newR

            End If

 

            newSR = _is.Reader.Reopen

            If newSR IsNot _is.Reader Then

                ' SEARCHER

                Try

                    ' We dont need this since we created the Searcher with a string "c:\asdasfd\"

                    '_is.Reader.Close 

                    _is.Close()

                Catch ex As Exception

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Create a new Searcher using the reopened reader

                _is = New IndexSearcher(newSR)

            End If

        Catch ex As Exception

            MessageBox.Show("Error reopening index: " + ex.Message)

        End Try

    End Sub

 

    Private Sub btnIsCurent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIsCurent.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Try

            MessageBox.Show("Reader is current=" + _ir.IsCurrent.ToString)

            MessageBox.Show("Searcher is current=" + _is.Reader.IsCurrent.ToString)

        Catch ex As Exception

            MessageBox.Show("ERROR gettings IsCurrent: " + ex.Message + vbCrLf + ex.ToString)

        End Try

    End Sub

 

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

        If txtSearch.Text.Trim <> "" Then

            Dim qp As New Lucene.Net.QueryParsers.QueryParser("", New Lucene.Net.Analysis.WhitespaceAnalyzer())

            Dim q As Query = qp.Parse(txtSearch.Text)

            Dim topD As Lucene.Net.Search.TopDocs = _is.Search(q, 100)

        End If

    End Sub

 

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Dim _iw As IndexWriter

        Try

            _iw = New IndexWriter(txtIndexFolder.Text, New Lucene.Net.Analysis.WhitespaceAnalyzer(), False, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED)

            Dim d As New Lucene.Net.Documents.Document()

            Dim f As New Lucene.Net.Documents.Field("fieldName", "fieldValue", Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.ANALYZED)

            d.Add(f)

            _iw.AddDocument(d)

            _iw.Commit()

        Catch ex As Exception

            MessageBox.Show("Error: " + ex.Message + vbCrLf + ex.ToString)

        Finally

            If _iw IsNot Nothing Then

                _iw.Close()

            End If

        End Try

    End Sub

 

End Class

=======================================================

 

Saludos,

Luis

 

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 5:04 PM

To: 'lucene-net-dev@incubator.apache.org'

Subject: RE: Port of Java Lucene 2.9 is under way

 

Just to confirm I've just downloaded the version in the trunk and it’s the same version I have in my environment.

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 3:55 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi Michael

 

I'm not sure if I have latest version from the trunk. I'll check that right now.

 

The error is:

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246

   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235

   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491

   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"

 

 

>From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.

And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

 

I'll try to write a function to reproduce the problem.

 

Thanks in advance for your help.

 

Saludos, 

Luis

 

-----Original Message-----

From: Michael Garski [mailto:mgarski@myspace-inc.com] 

Sent: Thursday, October 15, 2009 12:42 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Luis,

 

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

 

Michael

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 

Sent: Wednesday, October 14, 2009 7:13 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi George

 

I just want to know the status of the 2.9 port.

 

I'm thinking of trying it because we are using 2.4 and I think we are

hitting a bug with the Reopen method.

I was looking for a solution and found a thread in the Java JIRA that says

the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with

a patch:

https://issues.apache.org/jira/browse/LUCENE-1453

 

The reopen function is very important for us because we update the index

very often, and right now we have to Close + Open each time we update the

index, and because we use custom sort field, we also need to warm up each

time we Close+Open, and all that seems to be solved with the Reopen. 

 

Thanks

 

Best regards

Luis

 

-----Original Message-----

From: George Aroush [mailto:george@aroush.net] 

Sent: Wednesday, September 16, 2009 9:32 PM

To: lucene-net-dev@incubator.apache.org;

lucene-net-user@incubator.apache.org

Subject: Port of Java Lucene 2.9 is under way

 

Hi folks,

 

 

 

This is to let you know that I have begun the porting process of Java Lucene

2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an

early release checked-into SVN.

 

 

 

If you are following Java Lucene mailing list, you will know that 2.9 is

currently undergoing release as Release Candidate 4 and RC5 is expected (a

bug was found in RC4).  My port is based on RC3, but changes between Java

Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

 

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net

releases very close; my hope is, any further ports should be an accumulation

of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk

release.  I'm not sure if this goal can be achieved, but we will see.

 

 

 

Regards,

 

 

 

-- George

 

 

 

 

 




RE: Port of Java Lucene 2.9 is under way

Posted by "Luis Fco. Ramirez Daza Gonzalez" <lu...@yahoo.com.mx>.
Hi Digy

Thanks for your help.

I have a question here.
I use the reader for other tasks, and later in my code the reader (_ir) is closed, and I just keep open the searcher. Or sometimes viceversa, I close the searcher and just keep the Reader open.
If I use a single Reader on both instances(_ir and _is), what happens if I close either one or the other? Wouldn’t the other one be closed too? 
Or that means that I can use a single Reader to open different instances of IndexSearcher and close an IndexSearcher without affecting the other Searcher instances?

Best regards
Luis

-----Original Message-----
From: Digy [mailto:digydigy@gmail.com] 
Sent: Friday, October 16, 2009 12:03 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Luis,

 

I think, you shouldn't reopen "_is.Reader". Just create a new IndexSearcher with the new "_ir".

Your code(converted to c#) is below. See the comments.

 

            IndexReader newR = _ir.Reopen();

            if (newR != _ir)

            {

                _ir.Close();

            }

            _ir = newR;

 

            //REMOVED

            //IndexReader newSR = _is.Reader.Reopen();

            //if (newSR != _is.Reader)

            //{

            //    _is.Close();

            //}

            //_is = new IndexSearcher(newSR);

            _is = new IndexSearcher(_ir); //<--ADDED

 

DIGY

 

 

 

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Friday, October 16, 2009 6:49 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi all

 

I've just created a new test project and I confirm that the exception occurs.

 

The steps to reproduce:

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Reopen Searcer and/or Reader. (Click "Reopen" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: 

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\Directory.cs:line 244

   at Lucene.Net.Store.FSDirectory.List() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\FSDirectory.cs:line 386

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 620

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 473

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\DirectoryIndexReader.cs:line 232

   at LuceneReopenTest.Form1.btnIsCurent_Click(Object sender, EventArgs e) in G:\Installers\Desarrollo\LuceneNET\Tests\LuceneReopenTest\LuceneReopenTest\Form1.vb:line 268"

 

If instead of using Reopen you do a Close + Open, there is no exception.

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Close+Open Searcer and/or Reader. (Click "Close" then the "Open" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: TRUE    :-)

 

My test project code is below. It is just a VB project with a single form.

Just create a new form, delete the "Form1.Designer.vb" file and paste the code in the "Form1.vb".

=======================================================

Imports Lucene.Net.Index

Imports Lucene.Net.Search

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Class Form1

    Inherits System.Windows.Forms.Form

 

    'Form overrides dispose to clean up the component list.

    <System.Diagnostics.DebuggerNonUserCode()> _

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

        Try

            If disposing AndAlso components IsNot Nothing Then

                components.Dispose()

            End If

        Finally

            MyBase.Dispose(disposing)

        End Try

    End Sub

 

    'Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

 

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer.  

    'Do not modify it using the code editor.

    <System.Diagnostics.DebuggerStepThrough()> _

    Private Sub InitializeComponent()

        Me.txtIndexFolder = New System.Windows.Forms.TextBox

        Me.btnBrowseFolder = New System.Windows.Forms.Button

        Me.bntOpen = New System.Windows.Forms.Button

        Me.btnClose = New System.Windows.Forms.Button

        Me.btnReopen = New System.Windows.Forms.Button

        Me.btnIsCurent = New System.Windows.Forms.Button

        Me.btnSearch = New System.Windows.Forms.Button

        Me.txtSearch = New System.Windows.Forms.TextBox

        Me.StatusStrip1 = New System.Windows.Forms.StatusStrip

        Me.statusLabel = New System.Windows.Forms.ToolStripStatusLabel

        Me.btnAdd = New System.Windows.Forms.Button

        Me.StatusStrip1.SuspendLayout()

        Me.SuspendLayout()

        '

        'txtIndexFolder

        '

        Me.txtIndexFolder.Location = New System.Drawing.Point(12, 12)

        Me.txtIndexFolder.Name = "txtIndexFolder"

        Me.txtIndexFolder.Size = New System.Drawing.Size(713, 20)

        Me.txtIndexFolder.TabIndex = 0

        '

        'btnBrowseFolder

        '

        Me.btnBrowseFolder.Location = New System.Drawing.Point(731, 12)

        Me.btnBrowseFolder.Name = "btnBrowseFolder"

        Me.btnBrowseFolder.Size = New System.Drawing.Size(24, 20)

        Me.btnBrowseFolder.TabIndex = 1

        Me.btnBrowseFolder.Text = "..."

        Me.btnBrowseFolder.UseVisualStyleBackColor = True

        '

        'bntOpen

        '

        Me.bntOpen.Location = New System.Drawing.Point(12, 38)

        Me.bntOpen.Name = "bntOpen"

        Me.bntOpen.Size = New System.Drawing.Size(75, 23)

        Me.bntOpen.TabIndex = 2

        Me.bntOpen.Text = "Open"

        Me.bntOpen.UseVisualStyleBackColor = True

        '

        'btnClose

        '

        Me.btnClose.Location = New System.Drawing.Point(93, 38)

        Me.btnClose.Name = "btnClose"

        Me.btnClose.Size = New System.Drawing.Size(75, 23)

        Me.btnClose.TabIndex = 3

        Me.btnClose.Text = "Close"

        Me.btnClose.UseVisualStyleBackColor = True

        '

        'btnReopen

        '

        Me.btnReopen.Location = New System.Drawing.Point(174, 38)

        Me.btnReopen.Name = "btnReopen"

        Me.btnReopen.Size = New System.Drawing.Size(75, 23)

        Me.btnReopen.TabIndex = 4

        Me.btnReopen.Text = "Reopen"

        Me.btnReopen.UseVisualStyleBackColor = True

        '

        'btnIsCurent

        '

        Me.btnIsCurent.Location = New System.Drawing.Point(255, 38)

        Me.btnIsCurent.Name = "btnIsCurent"

        Me.btnIsCurent.Size = New System.Drawing.Size(75, 23)

        Me.btnIsCurent.TabIndex = 5

        Me.btnIsCurent.Text = "IsCurrent?"

        Me.btnIsCurent.UseVisualStyleBackColor = True

        '

        'btnSearch

        '

        Me.btnSearch.Location = New System.Drawing.Point(680, 67)

        Me.btnSearch.Name = "btnSearch"

        Me.btnSearch.Size = New System.Drawing.Size(75, 20)

        Me.btnSearch.TabIndex = 6

        Me.btnSearch.Text = "Search"

        Me.btnSearch.UseVisualStyleBackColor = True

        '

        'txtSearch

        '

        Me.txtSearch.Location = New System.Drawing.Point(12, 67)

        Me.txtSearch.Name = "txtSearch"

        Me.txtSearch.Size = New System.Drawing.Size(662, 20)

        Me.txtSearch.TabIndex = 7

        '

        'StatusStrip1

        '

        Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.statusLabel})

        Me.StatusStrip1.Location = New System.Drawing.Point(0, 375)

        Me.StatusStrip1.Name = "StatusStrip1"

        Me.StatusStrip1.Size = New System.Drawing.Size(767, 22)

        Me.StatusStrip1.TabIndex = 8

        Me.StatusStrip1.Text = "StatusStrip1"

        '

        'statusLabel

        '

        Me.statusLabel.Name = "statusLabel"

        Me.statusLabel.Size = New System.Drawing.Size(111, 17)

        Me.statusLabel.Text = "ToolStripStatusLabel1"

        '

        'btnAdd

        '

        Me.btnAdd.Location = New System.Drawing.Point(336, 38)

        Me.btnAdd.Name = "btnAdd"

        Me.btnAdd.Size = New System.Drawing.Size(75, 23)

        Me.btnAdd.TabIndex = 9

        Me.btnAdd.Text = "Add doc"

        Me.btnAdd.UseVisualStyleBackColor = True

        '

        'Form1

        '

        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

        Me.ClientSize = New System.Drawing.Size(767, 397)

        Me.Controls.Add(Me.btnAdd)

        Me.Controls.Add(Me.StatusStrip1)

        Me.Controls.Add(Me.txtSearch)

        Me.Controls.Add(Me.btnSearch)

        Me.Controls.Add(Me.btnIsCurent)

        Me.Controls.Add(Me.btnReopen)

        Me.Controls.Add(Me.btnClose)

        Me.Controls.Add(Me.bntOpen)

        Me.Controls.Add(Me.btnBrowseFolder)

        Me.Controls.Add(Me.txtIndexFolder)

        Me.Name = "Form1"

        Me.Text = "Form1"

        Me.StatusStrip1.ResumeLayout(False)

        Me.StatusStrip1.PerformLayout()

        Me.ResumeLayout(False)

        Me.PerformLayout()

 

    End Sub

    Friend WithEvents txtIndexFolder As System.Windows.Forms.TextBox

    Friend WithEvents btnBrowseFolder As System.Windows.Forms.Button

    Friend WithEvents bntOpen As System.Windows.Forms.Button

    Friend WithEvents btnClose As System.Windows.Forms.Button

    Friend WithEvents btnReopen As System.Windows.Forms.Button

    Friend WithEvents btnIsCurent As System.Windows.Forms.Button

    Friend WithEvents btnSearch As System.Windows.Forms.Button

    Friend WithEvents txtSearch As System.Windows.Forms.TextBox

    Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip

    Friend WithEvents statusLabel As System.Windows.Forms.ToolStripStatusLabel

    Friend WithEvents btnAdd As System.Windows.Forms.Button

 

 

    Private _ir As IndexReader

    Private _is As IndexSearcher

 

    Private Sub btnBrowseFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseFolder.Click

        Using ofd As New FolderBrowserDialog

            ofd.SelectedPath = txtIndexFolder.Text

 

            If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then

                txtIndexFolder.Text = ofd.SelectedPath

            End If

        End Using

    End Sub

 

    Private Sub bntOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntOpen.Click

        Dim sDir As String = txtIndexFolder.Text.Trim

        If sDir = "" OrElse IO.Directory.Exists(sDir) = False Then

            MessageBox.Show("Select the index directory.")

            Exit Sub

        End If

 

        Try

            _ir.EnsureOpen()

            MessageBox.Show("Reader is already open.")

            Exit Sub

        Catch ex As Exception

            ' Reader is not open,    continue

        End Try

 

        _ir = IndexReader.Open(sDir)

        _is = New IndexSearcher(sDir)

        statusLabel.Text = "Index open."

    End Sub

 

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        _ir.Close()

        _is.Close()

        statusLabel.Text = "Index closed"

    End Sub

 

    Private Sub btnReopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReopen.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        Dim newR As IndexReader

        Dim newSR As IndexReader

        Try

            newR = _ir.Reopen

            If newR IsNot _ir Then

                ' READER

                ' Store a reference to the old reader to close it later

                Try

                    _ir.Close()

                Catch

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Set Reader to the new reopened instance

                _ir = newR

            End If

 

            newSR = _is.Reader.Reopen

            If newSR IsNot _is.Reader Then

                ' SEARCHER

                Try

                    ' We dont need this since we created the Searcher with a string "c:\asdasfd\"

                    '_is.Reader.Close 

                    _is.Close()

                Catch ex As Exception

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Create a new Searcher using the reopened reader

                _is = New IndexSearcher(newSR)

            End If

        Catch ex As Exception

            MessageBox.Show("Error reopening index: " + ex.Message)

        End Try

    End Sub

 

    Private Sub btnIsCurent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIsCurent.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Try

            MessageBox.Show("Reader is current=" + _ir.IsCurrent.ToString)

            MessageBox.Show("Searcher is current=" + _is.Reader.IsCurrent.ToString)

        Catch ex As Exception

            MessageBox.Show("ERROR gettings IsCurrent: " + ex.Message + vbCrLf + ex.ToString)

        End Try

    End Sub

 

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

        If txtSearch.Text.Trim <> "" Then

            Dim qp As New Lucene.Net.QueryParsers.QueryParser("", New Lucene.Net.Analysis.WhitespaceAnalyzer())

            Dim q As Query = qp.Parse(txtSearch.Text)

            Dim topD As Lucene.Net.Search.TopDocs = _is.Search(q, 100)

        End If

    End Sub

 

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Dim _iw As IndexWriter

        Try

            _iw = New IndexWriter(txtIndexFolder.Text, New Lucene.Net.Analysis.WhitespaceAnalyzer(), False, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED)

            Dim d As New Lucene.Net.Documents.Document()

            Dim f As New Lucene.Net.Documents.Field("fieldName", "fieldValue", Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.ANALYZED)

            d.Add(f)

            _iw.AddDocument(d)

            _iw.Commit()

        Catch ex As Exception

            MessageBox.Show("Error: " + ex.Message + vbCrLf + ex.ToString)

        Finally

            If _iw IsNot Nothing Then

                _iw.Close()

            End If

        End Try

    End Sub

 

End Class

=======================================================

 

Saludos,

Luis

 

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 5:04 PM

To: 'lucene-net-dev@incubator.apache.org'

Subject: RE: Port of Java Lucene 2.9 is under way

 

Just to confirm I've just downloaded the version in the trunk and it’s the same version I have in my environment.

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 3:55 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi Michael

 

I'm not sure if I have latest version from the trunk. I'll check that right now.

 

The error is:

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246

   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235

   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491

   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"

 

 

>From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.

And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

 

I'll try to write a function to reproduce the problem.

 

Thanks in advance for your help.

 

Saludos, 

Luis

 

-----Original Message-----

From: Michael Garski [mailto:mgarski@myspace-inc.com] 

Sent: Thursday, October 15, 2009 12:42 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Luis,

 

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

 

Michael

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 

Sent: Wednesday, October 14, 2009 7:13 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi George

 

I just want to know the status of the 2.9 port.

 

I'm thinking of trying it because we are using 2.4 and I think we are

hitting a bug with the Reopen method.

I was looking for a solution and found a thread in the Java JIRA that says

the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with

a patch:

https://issues.apache.org/jira/browse/LUCENE-1453

 

The reopen function is very important for us because we update the index

very often, and right now we have to Close + Open each time we update the

index, and because we use custom sort field, we also need to warm up each

time we Close+Open, and all that seems to be solved with the Reopen. 

 

Thanks

 

Best regards

Luis

 

-----Original Message-----

From: George Aroush [mailto:george@aroush.net] 

Sent: Wednesday, September 16, 2009 9:32 PM

To: lucene-net-dev@incubator.apache.org;

lucene-net-user@incubator.apache.org

Subject: Port of Java Lucene 2.9 is under way

 

Hi folks,

 

 

 

This is to let you know that I have begun the porting process of Java Lucene

2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an

early release checked-into SVN.

 

 

 

If you are following Java Lucene mailing list, you will know that 2.9 is

currently undergoing release as Release Candidate 4 and RC5 is expected (a

bug was found in RC4).  My port is based on RC3, but changes between Java

Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

 

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net

releases very close; my hope is, any further ports should be an accumulation

of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk

release.  I'm not sure if this goal can be achieved, but we will see.

 

 

 

Regards,

 

 

 

-- George

 

 

 

 

 




RE: Port of Java Lucene 2.9 is under way

Posted by Digy <di...@gmail.com>.
Hi Luis,

 

I think, you shouldn't reopen "_is.Reader". Just create a new IndexSearcher with the new "_ir".

Your code(converted to c#) is below. See the comments.

 

            IndexReader newR = _ir.Reopen();

            if (newR != _ir)

            {

                _ir.Close();

            }

            _ir = newR;

 

            //REMOVED

            //IndexReader newSR = _is.Reader.Reopen();

            //if (newSR != _is.Reader)

            //{

            //    _is.Close();

            //}

            //_is = new IndexSearcher(newSR);

            _is = new IndexSearcher(_ir); //<--ADDED

 

DIGY

 

 

 

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Friday, October 16, 2009 6:49 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi all

 

I've just created a new test project and I confirm that the exception occurs.

 

The steps to reproduce:

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Reopen Searcer and/or Reader. (Click "Reopen" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: 

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\Directory.cs:line 244

   at Lucene.Net.Store.FSDirectory.List() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\FSDirectory.cs:line 386

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 620

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 473

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\DirectoryIndexReader.cs:line 232

   at LuceneReopenTest.Form1.btnIsCurent_Click(Object sender, EventArgs e) in G:\Installers\Desarrollo\LuceneNET\Tests\LuceneReopenTest\LuceneReopenTest\Form1.vb:line 268"

 

If instead of using Reopen you do a Close + Open, there is no exception.

1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")

2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)

4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)

5. Close+Open Searcer and/or Reader. (Click "Close" then the "Open" button)

6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)

6.1 Here I get: TRUE    :-)

 

My test project code is below. It is just a VB project with a single form.

Just create a new form, delete the "Form1.Designer.vb" file and paste the code in the "Form1.vb".

=======================================================

Imports Lucene.Net.Index

Imports Lucene.Net.Search

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Class Form1

    Inherits System.Windows.Forms.Form

 

    'Form overrides dispose to clean up the component list.

    <System.Diagnostics.DebuggerNonUserCode()> _

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

        Try

            If disposing AndAlso components IsNot Nothing Then

                components.Dispose()

            End If

        Finally

            MyBase.Dispose(disposing)

        End Try

    End Sub

 

    'Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

 

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer.  

    'Do not modify it using the code editor.

    <System.Diagnostics.DebuggerStepThrough()> _

    Private Sub InitializeComponent()

        Me.txtIndexFolder = New System.Windows.Forms.TextBox

        Me.btnBrowseFolder = New System.Windows.Forms.Button

        Me.bntOpen = New System.Windows.Forms.Button

        Me.btnClose = New System.Windows.Forms.Button

        Me.btnReopen = New System.Windows.Forms.Button

        Me.btnIsCurent = New System.Windows.Forms.Button

        Me.btnSearch = New System.Windows.Forms.Button

        Me.txtSearch = New System.Windows.Forms.TextBox

        Me.StatusStrip1 = New System.Windows.Forms.StatusStrip

        Me.statusLabel = New System.Windows.Forms.ToolStripStatusLabel

        Me.btnAdd = New System.Windows.Forms.Button

        Me.StatusStrip1.SuspendLayout()

        Me.SuspendLayout()

        '

        'txtIndexFolder

        '

        Me.txtIndexFolder.Location = New System.Drawing.Point(12, 12)

        Me.txtIndexFolder.Name = "txtIndexFolder"

        Me.txtIndexFolder.Size = New System.Drawing.Size(713, 20)

        Me.txtIndexFolder.TabIndex = 0

        '

        'btnBrowseFolder

        '

        Me.btnBrowseFolder.Location = New System.Drawing.Point(731, 12)

        Me.btnBrowseFolder.Name = "btnBrowseFolder"

        Me.btnBrowseFolder.Size = New System.Drawing.Size(24, 20)

        Me.btnBrowseFolder.TabIndex = 1

        Me.btnBrowseFolder.Text = "..."

        Me.btnBrowseFolder.UseVisualStyleBackColor = True

        '

        'bntOpen

        '

        Me.bntOpen.Location = New System.Drawing.Point(12, 38)

        Me.bntOpen.Name = "bntOpen"

        Me.bntOpen.Size = New System.Drawing.Size(75, 23)

        Me.bntOpen.TabIndex = 2

        Me.bntOpen.Text = "Open"

        Me.bntOpen.UseVisualStyleBackColor = True

        '

        'btnClose

        '

        Me.btnClose.Location = New System.Drawing.Point(93, 38)

        Me.btnClose.Name = "btnClose"

        Me.btnClose.Size = New System.Drawing.Size(75, 23)

        Me.btnClose.TabIndex = 3

        Me.btnClose.Text = "Close"

        Me.btnClose.UseVisualStyleBackColor = True

        '

        'btnReopen

        '

        Me.btnReopen.Location = New System.Drawing.Point(174, 38)

        Me.btnReopen.Name = "btnReopen"

        Me.btnReopen.Size = New System.Drawing.Size(75, 23)

        Me.btnReopen.TabIndex = 4

        Me.btnReopen.Text = "Reopen"

        Me.btnReopen.UseVisualStyleBackColor = True

        '

        'btnIsCurent

        '

        Me.btnIsCurent.Location = New System.Drawing.Point(255, 38)

        Me.btnIsCurent.Name = "btnIsCurent"

        Me.btnIsCurent.Size = New System.Drawing.Size(75, 23)

        Me.btnIsCurent.TabIndex = 5

        Me.btnIsCurent.Text = "IsCurrent?"

        Me.btnIsCurent.UseVisualStyleBackColor = True

        '

        'btnSearch

        '

        Me.btnSearch.Location = New System.Drawing.Point(680, 67)

        Me.btnSearch.Name = "btnSearch"

        Me.btnSearch.Size = New System.Drawing.Size(75, 20)

        Me.btnSearch.TabIndex = 6

        Me.btnSearch.Text = "Search"

        Me.btnSearch.UseVisualStyleBackColor = True

        '

        'txtSearch

        '

        Me.txtSearch.Location = New System.Drawing.Point(12, 67)

        Me.txtSearch.Name = "txtSearch"

        Me.txtSearch.Size = New System.Drawing.Size(662, 20)

        Me.txtSearch.TabIndex = 7

        '

        'StatusStrip1

        '

        Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.statusLabel})

        Me.StatusStrip1.Location = New System.Drawing.Point(0, 375)

        Me.StatusStrip1.Name = "StatusStrip1"

        Me.StatusStrip1.Size = New System.Drawing.Size(767, 22)

        Me.StatusStrip1.TabIndex = 8

        Me.StatusStrip1.Text = "StatusStrip1"

        '

        'statusLabel

        '

        Me.statusLabel.Name = "statusLabel"

        Me.statusLabel.Size = New System.Drawing.Size(111, 17)

        Me.statusLabel.Text = "ToolStripStatusLabel1"

        '

        'btnAdd

        '

        Me.btnAdd.Location = New System.Drawing.Point(336, 38)

        Me.btnAdd.Name = "btnAdd"

        Me.btnAdd.Size = New System.Drawing.Size(75, 23)

        Me.btnAdd.TabIndex = 9

        Me.btnAdd.Text = "Add doc"

        Me.btnAdd.UseVisualStyleBackColor = True

        '

        'Form1

        '

        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

        Me.ClientSize = New System.Drawing.Size(767, 397)

        Me.Controls.Add(Me.btnAdd)

        Me.Controls.Add(Me.StatusStrip1)

        Me.Controls.Add(Me.txtSearch)

        Me.Controls.Add(Me.btnSearch)

        Me.Controls.Add(Me.btnIsCurent)

        Me.Controls.Add(Me.btnReopen)

        Me.Controls.Add(Me.btnClose)

        Me.Controls.Add(Me.bntOpen)

        Me.Controls.Add(Me.btnBrowseFolder)

        Me.Controls.Add(Me.txtIndexFolder)

        Me.Name = "Form1"

        Me.Text = "Form1"

        Me.StatusStrip1.ResumeLayout(False)

        Me.StatusStrip1.PerformLayout()

        Me.ResumeLayout(False)

        Me.PerformLayout()

 

    End Sub

    Friend WithEvents txtIndexFolder As System.Windows.Forms.TextBox

    Friend WithEvents btnBrowseFolder As System.Windows.Forms.Button

    Friend WithEvents bntOpen As System.Windows.Forms.Button

    Friend WithEvents btnClose As System.Windows.Forms.Button

    Friend WithEvents btnReopen As System.Windows.Forms.Button

    Friend WithEvents btnIsCurent As System.Windows.Forms.Button

    Friend WithEvents btnSearch As System.Windows.Forms.Button

    Friend WithEvents txtSearch As System.Windows.Forms.TextBox

    Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip

    Friend WithEvents statusLabel As System.Windows.Forms.ToolStripStatusLabel

    Friend WithEvents btnAdd As System.Windows.Forms.Button

 

 

    Private _ir As IndexReader

    Private _is As IndexSearcher

 

    Private Sub btnBrowseFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseFolder.Click

        Using ofd As New FolderBrowserDialog

            ofd.SelectedPath = txtIndexFolder.Text

 

            If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then

                txtIndexFolder.Text = ofd.SelectedPath

            End If

        End Using

    End Sub

 

    Private Sub bntOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntOpen.Click

        Dim sDir As String = txtIndexFolder.Text.Trim

        If sDir = "" OrElse IO.Directory.Exists(sDir) = False Then

            MessageBox.Show("Select the index directory.")

            Exit Sub

        End If

 

        Try

            _ir.EnsureOpen()

            MessageBox.Show("Reader is already open.")

            Exit Sub

        Catch ex As Exception

            ' Reader is not open,    continue

        End Try

 

        _ir = IndexReader.Open(sDir)

        _is = New IndexSearcher(sDir)

        statusLabel.Text = "Index open."

    End Sub

 

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        _ir.Close()

        _is.Close()

        statusLabel.Text = "Index closed"

    End Sub

 

    Private Sub btnReopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReopen.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

 

        Dim newR As IndexReader

        Dim newSR As IndexReader

        Try

            newR = _ir.Reopen

            If newR IsNot _ir Then

                ' READER

                ' Store a reference to the old reader to close it later

                Try

                    _ir.Close()

                Catch

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Set Reader to the new reopened instance

                _ir = newR

            End If

 

            newSR = _is.Reader.Reopen

            If newSR IsNot _is.Reader Then

                ' SEARCHER

                Try

                    ' We dont need this since we created the Searcher with a string "c:\asdasfd\"

                    '_is.Reader.Close 

                    _is.Close()

                Catch ex As Exception

                    ' do Nothing, just in case its already closed an exception can occur

                End Try

 

                ' Create a new Searcher using the reopened reader

                _is = New IndexSearcher(newSR)

            End If

        Catch ex As Exception

            MessageBox.Show("Error reopening index: " + ex.Message)

        End Try

    End Sub

 

    Private Sub btnIsCurent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIsCurent.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Try

            MessageBox.Show("Reader is current=" + _ir.IsCurrent.ToString)

            MessageBox.Show("Searcher is current=" + _is.Reader.IsCurrent.ToString)

        Catch ex As Exception

            MessageBox.Show("ERROR gettings IsCurrent: " + ex.Message + vbCrLf + ex.ToString)

        End Try

    End Sub

 

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

        If txtSearch.Text.Trim <> "" Then

            Dim qp As New Lucene.Net.QueryParsers.QueryParser("", New Lucene.Net.Analysis.WhitespaceAnalyzer())

            Dim q As Query = qp.Parse(txtSearch.Text)

            Dim topD As Lucene.Net.Search.TopDocs = _is.Search(q, 100)

        End If

    End Sub

 

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Try

            _ir.EnsureOpen()

        Catch ex As Exception

            MessageBox.Show("Reader is closed.")

            Exit Sub

        End Try

        Dim _iw As IndexWriter

        Try

            _iw = New IndexWriter(txtIndexFolder.Text, New Lucene.Net.Analysis.WhitespaceAnalyzer(), False, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED)

            Dim d As New Lucene.Net.Documents.Document()

            Dim f As New Lucene.Net.Documents.Field("fieldName", "fieldValue", Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.ANALYZED)

            d.Add(f)

            _iw.AddDocument(d)

            _iw.Commit()

        Catch ex As Exception

            MessageBox.Show("Error: " + ex.Message + vbCrLf + ex.ToString)

        Finally

            If _iw IsNot Nothing Then

                _iw.Close()

            End If

        End Try

    End Sub

 

End Class

=======================================================

 

Saludos,

Luis

 

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 5:04 PM

To: 'lucene-net-dev@incubator.apache.org'

Subject: RE: Port of Java Lucene 2.9 is under way

 

Just to confirm I've just downloaded the version in the trunk and it’s the same version I have in my environment.

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 

Sent: Thursday, October 15, 2009 3:55 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi Michael

 

I'm not sure if I have latest version from the trunk. I'll check that right now.

 

The error is:

"Lucene.Net.Store.AlreadyClosedException: this Directory is closed

   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246

   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389

   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623

   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476

   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235

   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491

   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"

 

 

>From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.

And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

 

I'll try to write a function to reproduce the problem.

 

Thanks in advance for your help.

 

Saludos, 

Luis

 

-----Original Message-----

From: Michael Garski [mailto:mgarski@myspace-inc.com] 

Sent: Thursday, October 15, 2009 12:42 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Luis,

 

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

 

Michael

 

-----Original Message-----

From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 

Sent: Wednesday, October 14, 2009 7:13 PM

To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org

Subject: RE: Port of Java Lucene 2.9 is under way

 

Hi George

 

I just want to know the status of the 2.9 port.

 

I'm thinking of trying it because we are using 2.4 and I think we are

hitting a bug with the Reopen method.

I was looking for a solution and found a thread in the Java JIRA that says

the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with

a patch:

https://issues.apache.org/jira/browse/LUCENE-1453

 

The reopen function is very important for us because we update the index

very often, and right now we have to Close + Open each time we update the

index, and because we use custom sort field, we also need to warm up each

time we Close+Open, and all that seems to be solved with the Reopen. 

 

Thanks

 

Best regards

Luis

 

-----Original Message-----

From: George Aroush [mailto:george@aroush.net] 

Sent: Wednesday, September 16, 2009 9:32 PM

To: lucene-net-dev@incubator.apache.org;

lucene-net-user@incubator.apache.org

Subject: Port of Java Lucene 2.9 is under way

 

Hi folks,

 

 

 

This is to let you know that I have begun the porting process of Java Lucene

2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an

early release checked-into SVN.

 

 

 

If you are following Java Lucene mailing list, you will know that 2.9 is

currently undergoing release as Release Candidate 4 and RC5 is expected (a

bug was found in RC4).  My port is based on RC3, but changes between Java

Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

 

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net

releases very close; my hope is, any further ports should be an accumulation

of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk

release.  I'm not sure if this goal can be achieved, but we will see.

 

 

 

Regards,

 

 

 

-- George

 

 

 

 

 


RE: Port of Java Lucene 2.9 is under way

Posted by "Luis Fco. Ramirez Daza Gonzalez" <lu...@yahoo.com.mx>.
Hi all

I've just created a new test project and I confirm that the exception occurs.

The steps to reproduce:
1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")
2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)
3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)
4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)
5. Reopen Searcer and/or Reader. (Click "Reopen" button)
6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)
6.1 Here I get: 
"Lucene.Net.Store.AlreadyClosedException: this Directory is closed
   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\Directory.cs:line 244
   at Lucene.Net.Store.FSDirectory.List() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Store\FSDirectory.cs:line 386
   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 620
   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\SegmentInfos.cs:line 473
   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Installers\Desarrollo\LuceneNET\SVN\LuceneNET_SVN\trunk(2.4.0,2009-09-17)\C#\src\Lucene.Net\Index\DirectoryIndexReader.cs:line 232
   at LuceneReopenTest.Form1.btnIsCurent_Click(Object sender, EventArgs e) in G:\Installers\Desarrollo\LuceneNET\Tests\LuceneReopenTest\LuceneReopenTest\Form1.vb:line 268"

If instead of using Reopen you do a Close + Open, there is no exception.
1. Open the index Reader and/or Searcher. (Select and index flder or wrtite the path in the first textbox, then Click button "Open")
2. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)
3. Modify the index. (Click the "Add doc" button, this will add a doc and close the Writer)
4. Check IsCurrent. Must return FALSE (Click the "IsCurrent?" button)
5. Close+Open Searcer and/or Reader. (Click "Close" then the "Open" button)
6. Check IsCurrent. Must return TRUE (Click the "IsCurrent?" button)
6.1 Here I get: TRUE    :-)

My test project code is below. It is just a VB project with a single form.
Just create a new form, delete the "Form1.Designer.vb" file and paste the code in the "Form1.vb".
=======================================================
Imports Lucene.Net.Index
Imports Lucene.Net.Search
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.txtIndexFolder = New System.Windows.Forms.TextBox
        Me.btnBrowseFolder = New System.Windows.Forms.Button
        Me.bntOpen = New System.Windows.Forms.Button
        Me.btnClose = New System.Windows.Forms.Button
        Me.btnReopen = New System.Windows.Forms.Button
        Me.btnIsCurent = New System.Windows.Forms.Button
        Me.btnSearch = New System.Windows.Forms.Button
        Me.txtSearch = New System.Windows.Forms.TextBox
        Me.StatusStrip1 = New System.Windows.Forms.StatusStrip
        Me.statusLabel = New System.Windows.Forms.ToolStripStatusLabel
        Me.btnAdd = New System.Windows.Forms.Button
        Me.StatusStrip1.SuspendLayout()
        Me.SuspendLayout()
        '
        'txtIndexFolder
        '
        Me.txtIndexFolder.Location = New System.Drawing.Point(12, 12)
        Me.txtIndexFolder.Name = "txtIndexFolder"
        Me.txtIndexFolder.Size = New System.Drawing.Size(713, 20)
        Me.txtIndexFolder.TabIndex = 0
        '
        'btnBrowseFolder
        '
        Me.btnBrowseFolder.Location = New System.Drawing.Point(731, 12)
        Me.btnBrowseFolder.Name = "btnBrowseFolder"
        Me.btnBrowseFolder.Size = New System.Drawing.Size(24, 20)
        Me.btnBrowseFolder.TabIndex = 1
        Me.btnBrowseFolder.Text = "..."
        Me.btnBrowseFolder.UseVisualStyleBackColor = True
        '
        'bntOpen
        '
        Me.bntOpen.Location = New System.Drawing.Point(12, 38)
        Me.bntOpen.Name = "bntOpen"
        Me.bntOpen.Size = New System.Drawing.Size(75, 23)
        Me.bntOpen.TabIndex = 2
        Me.bntOpen.Text = "Open"
        Me.bntOpen.UseVisualStyleBackColor = True
        '
        'btnClose
        '
        Me.btnClose.Location = New System.Drawing.Point(93, 38)
        Me.btnClose.Name = "btnClose"
        Me.btnClose.Size = New System.Drawing.Size(75, 23)
        Me.btnClose.TabIndex = 3
        Me.btnClose.Text = "Close"
        Me.btnClose.UseVisualStyleBackColor = True
        '
        'btnReopen
        '
        Me.btnReopen.Location = New System.Drawing.Point(174, 38)
        Me.btnReopen.Name = "btnReopen"
        Me.btnReopen.Size = New System.Drawing.Size(75, 23)
        Me.btnReopen.TabIndex = 4
        Me.btnReopen.Text = "Reopen"
        Me.btnReopen.UseVisualStyleBackColor = True
        '
        'btnIsCurent
        '
        Me.btnIsCurent.Location = New System.Drawing.Point(255, 38)
        Me.btnIsCurent.Name = "btnIsCurent"
        Me.btnIsCurent.Size = New System.Drawing.Size(75, 23)
        Me.btnIsCurent.TabIndex = 5
        Me.btnIsCurent.Text = "IsCurrent?"
        Me.btnIsCurent.UseVisualStyleBackColor = True
        '
        'btnSearch
        '
        Me.btnSearch.Location = New System.Drawing.Point(680, 67)
        Me.btnSearch.Name = "btnSearch"
        Me.btnSearch.Size = New System.Drawing.Size(75, 20)
        Me.btnSearch.TabIndex = 6
        Me.btnSearch.Text = "Search"
        Me.btnSearch.UseVisualStyleBackColor = True
        '
        'txtSearch
        '
        Me.txtSearch.Location = New System.Drawing.Point(12, 67)
        Me.txtSearch.Name = "txtSearch"
        Me.txtSearch.Size = New System.Drawing.Size(662, 20)
        Me.txtSearch.TabIndex = 7
        '
        'StatusStrip1
        '
        Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.statusLabel})
        Me.StatusStrip1.Location = New System.Drawing.Point(0, 375)
        Me.StatusStrip1.Name = "StatusStrip1"
        Me.StatusStrip1.Size = New System.Drawing.Size(767, 22)
        Me.StatusStrip1.TabIndex = 8
        Me.StatusStrip1.Text = "StatusStrip1"
        '
        'statusLabel
        '
        Me.statusLabel.Name = "statusLabel"
        Me.statusLabel.Size = New System.Drawing.Size(111, 17)
        Me.statusLabel.Text = "ToolStripStatusLabel1"
        '
        'btnAdd
        '
        Me.btnAdd.Location = New System.Drawing.Point(336, 38)
        Me.btnAdd.Name = "btnAdd"
        Me.btnAdd.Size = New System.Drawing.Size(75, 23)
        Me.btnAdd.TabIndex = 9
        Me.btnAdd.Text = "Add doc"
        Me.btnAdd.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(767, 397)
        Me.Controls.Add(Me.btnAdd)
        Me.Controls.Add(Me.StatusStrip1)
        Me.Controls.Add(Me.txtSearch)
        Me.Controls.Add(Me.btnSearch)
        Me.Controls.Add(Me.btnIsCurent)
        Me.Controls.Add(Me.btnReopen)
        Me.Controls.Add(Me.btnClose)
        Me.Controls.Add(Me.bntOpen)
        Me.Controls.Add(Me.btnBrowseFolder)
        Me.Controls.Add(Me.txtIndexFolder)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.StatusStrip1.ResumeLayout(False)
        Me.StatusStrip1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents txtIndexFolder As System.Windows.Forms.TextBox
    Friend WithEvents btnBrowseFolder As System.Windows.Forms.Button
    Friend WithEvents bntOpen As System.Windows.Forms.Button
    Friend WithEvents btnClose As System.Windows.Forms.Button
    Friend WithEvents btnReopen As System.Windows.Forms.Button
    Friend WithEvents btnIsCurent As System.Windows.Forms.Button
    Friend WithEvents btnSearch As System.Windows.Forms.Button
    Friend WithEvents txtSearch As System.Windows.Forms.TextBox
    Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip
    Friend WithEvents statusLabel As System.Windows.Forms.ToolStripStatusLabel
    Friend WithEvents btnAdd As System.Windows.Forms.Button


    Private _ir As IndexReader
    Private _is As IndexSearcher

    Private Sub btnBrowseFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseFolder.Click
        Using ofd As New FolderBrowserDialog
            ofd.SelectedPath = txtIndexFolder.Text

            If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
                txtIndexFolder.Text = ofd.SelectedPath
            End If
        End Using
    End Sub

    Private Sub bntOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntOpen.Click
        Dim sDir As String = txtIndexFolder.Text.Trim
        If sDir = "" OrElse IO.Directory.Exists(sDir) = False Then
            MessageBox.Show("Select the index directory.")
            Exit Sub
        End If

        Try
            _ir.EnsureOpen()
            MessageBox.Show("Reader is already open.")
            Exit Sub
        Catch ex As Exception
            ' Reader is not open,    continue
        End Try

        _ir = IndexReader.Open(sDir)
        _is = New IndexSearcher(sDir)
        statusLabel.Text = "Index open."
    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Try
            _ir.EnsureOpen()
        Catch ex As Exception
            MessageBox.Show("Reader is closed.")
            Exit Sub
        End Try

        _ir.Close()
        _is.Close()
        statusLabel.Text = "Index closed"
    End Sub

    Private Sub btnReopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReopen.Click
        Try
            _ir.EnsureOpen()
        Catch ex As Exception
            MessageBox.Show("Reader is closed.")
            Exit Sub
        End Try

        Dim newR As IndexReader
        Dim newSR As IndexReader
        Try
            newR = _ir.Reopen
            If newR IsNot _ir Then
                ' READER
                ' Store a reference to the old reader to close it later
                Try
                    _ir.Close()
                Catch
                    ' do Nothing, just in case its already closed an exception can occur
                End Try

                ' Set Reader to the new reopened instance
                _ir = newR
            End If

            newSR = _is.Reader.Reopen
            If newSR IsNot _is.Reader Then
                ' SEARCHER
                Try
                    ' We dont need this since we created the Searcher with a string "c:\asdasfd\"
                    '_is.Reader.Close 
                    _is.Close()
                Catch ex As Exception
                    ' do Nothing, just in case its already closed an exception can occur
                End Try

                ' Create a new Searcher using the reopened reader
                _is = New IndexSearcher(newSR)
            End If
        Catch ex As Exception
            MessageBox.Show("Error reopening index: " + ex.Message)
        End Try
    End Sub

    Private Sub btnIsCurent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIsCurent.Click
        Try
            _ir.EnsureOpen()
        Catch ex As Exception
            MessageBox.Show("Reader is closed.")
            Exit Sub
        End Try
        Try
            MessageBox.Show("Reader is current=" + _ir.IsCurrent.ToString)
            MessageBox.Show("Searcher is current=" + _is.Reader.IsCurrent.ToString)
        Catch ex As Exception
            MessageBox.Show("ERROR gettings IsCurrent: " + ex.Message + vbCrLf + ex.ToString)
        End Try
    End Sub

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        If txtSearch.Text.Trim <> "" Then
            Dim qp As New Lucene.Net.QueryParsers.QueryParser("", New Lucene.Net.Analysis.WhitespaceAnalyzer())
            Dim q As Query = qp.Parse(txtSearch.Text)
            Dim topD As Lucene.Net.Search.TopDocs = _is.Search(q, 100)
        End If
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        Try
            _ir.EnsureOpen()
        Catch ex As Exception
            MessageBox.Show("Reader is closed.")
            Exit Sub
        End Try
        Dim _iw As IndexWriter
        Try
            _iw = New IndexWriter(txtIndexFolder.Text, New Lucene.Net.Analysis.WhitespaceAnalyzer(), False, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED)
            Dim d As New Lucene.Net.Documents.Document()
            Dim f As New Lucene.Net.Documents.Field("fieldName", "fieldValue", Lucene.Net.Documents.Field.Store.YES, Lucene.Net.Documents.Field.Index.ANALYZED)
            d.Add(f)
            _iw.AddDocument(d)
            _iw.Commit()
        Catch ex As Exception
            MessageBox.Show("Error: " + ex.Message + vbCrLf + ex.ToString)
        Finally
            If _iw IsNot Nothing Then
                _iw.Close()
            End If
        End Try
    End Sub

End Class
=======================================================

Saludos,
Luis


-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Thursday, October 15, 2009 5:04 PM
To: 'lucene-net-dev@incubator.apache.org'
Subject: RE: Port of Java Lucene 2.9 is under way

Just to confirm I've just downloaded the version in the trunk and it’s the same version I have in my environment.

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Thursday, October 15, 2009 3:55 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Michael

I'm not sure if I have latest version from the trunk. I'll check that right now.

The error is:
"Lucene.Net.Store.AlreadyClosedException: this Directory is closed
   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246
   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389
   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623
   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476
   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235
   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491
   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"


>From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.
And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

I'll try to write a function to reproduce the problem.

Thanks in advance for your help.

Saludos, 
Luis

-----Original Message-----
From: Michael Garski [mailto:mgarski@myspace-inc.com] 
Sent: Thursday, October 15, 2009 12:42 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Luis,

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

Michael

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 
Sent: Wednesday, October 14, 2009 7:13 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi George

I just want to know the status of the 2.9 port.

I'm thinking of trying it because we are using 2.4 and I think we are
hitting a bug with the Reopen method.
I was looking for a solution and found a thread in the Java JIRA that says
the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with
a patch:
https://issues.apache.org/jira/browse/LUCENE-1453

The reopen function is very important for us because we update the index
very often, and right now we have to Close + Open each time we update the
index, and because we use custom sort field, we also need to warm up each
time we Close+Open, and all that seems to be solved with the Reopen. 

Thanks

Best regards
Luis

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: Wednesday, September 16, 2009 9:32 PM
To: lucene-net-dev@incubator.apache.org;
lucene-net-user@incubator.apache.org
Subject: Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George







RE: Port of Java Lucene 2.9 is under way

Posted by Michael Garski <mg...@myspace-inc.com>.
Interesting - we are using the latest in the trunk and are not experiencing this issue due to how we are opening/reopening the readers:

Creation:

IndexReader reader = IndexReader.Open(pathToIndex);
IndexSearcher searcher = new IndexSearcher(reader);

Reopen:

IndexReader newReader = searcher.Reader.Reopen();
// ensure the reader has actually changed
if(newReader != searcher.Reader)
{
	IndexSearcher newSearcher = new IndexSearcher(newReader);
	searcher.Reader.Close();
	searcher.Close();
	searcher = newSearcher;
}

The reader on the old searcher must be manually closed as the searcher was created with the reader.

Michael


-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Thursday, October 15, 2009 3:04 PM
To: lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Just to confirm I've just downloaded the version in the trunk and it’s the same version I have in my environment.

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Thursday, October 15, 2009 3:55 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Michael

I'm not sure if I have latest version from the trunk. I'll check that right now.

The error is:
"Lucene.Net.Store.AlreadyClosedException: this Directory is closed
   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246
   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389
   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623
   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476
   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235
   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491
   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"


From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.
And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

I'll try to write a function to reproduce the problem.

Thanks in advance for your help.

Saludos, 
Luis

-----Original Message-----
From: Michael Garski [mailto:mgarski@myspace-inc.com] 
Sent: Thursday, October 15, 2009 12:42 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Luis,

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

Michael

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 
Sent: Wednesday, October 14, 2009 7:13 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi George

I just want to know the status of the 2.9 port.

I'm thinking of trying it because we are using 2.4 and I think we are
hitting a bug with the Reopen method.
I was looking for a solution and found a thread in the Java JIRA that says
the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with
a patch:
https://issues.apache.org/jira/browse/LUCENE-1453

The reopen function is very important for us because we update the index
very often, and right now we have to Close + Open each time we update the
index, and because we use custom sort field, we also need to warm up each
time we Close+Open, and all that seems to be solved with the Reopen. 

Thanks

Best regards
Luis

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: Wednesday, September 16, 2009 9:32 PM
To: lucene-net-dev@incubator.apache.org;
lucene-net-user@incubator.apache.org
Subject: Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George








RE: Port of Java Lucene 2.9 is under way

Posted by "Luis Fco. Ramirez Daza Gonzalez" <lu...@yahoo.com.mx>.
Just to confirm I've just downloaded the version in the trunk and it’s the same version I have in my environment.

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luisfco_w@yahoo.com.mx] 
Sent: Thursday, October 15, 2009 3:55 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi Michael

I'm not sure if I have latest version from the trunk. I'll check that right now.

The error is:
"Lucene.Net.Store.AlreadyClosedException: this Directory is closed
   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246
   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389
   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623
   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476
   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235
   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491
   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"


>From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.
And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

I'll try to write a function to reproduce the problem.

Thanks in advance for your help.

Saludos, 
Luis

-----Original Message-----
From: Michael Garski [mailto:mgarski@myspace-inc.com] 
Sent: Thursday, October 15, 2009 12:42 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Luis,

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

Michael

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 
Sent: Wednesday, October 14, 2009 7:13 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi George

I just want to know the status of the 2.9 port.

I'm thinking of trying it because we are using 2.4 and I think we are
hitting a bug with the Reopen method.
I was looking for a solution and found a thread in the Java JIRA that says
the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with
a patch:
https://issues.apache.org/jira/browse/LUCENE-1453

The reopen function is very important for us because we update the index
very often, and right now we have to Close + Open each time we update the
index, and because we use custom sort field, we also need to warm up each
time we Close+Open, and all that seems to be solved with the Reopen. 

Thanks

Best regards
Luis

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: Wednesday, September 16, 2009 9:32 PM
To: lucene-net-dev@incubator.apache.org;
lucene-net-user@incubator.apache.org
Subject: Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George







RE: Port of Java Lucene 2.9 is under way

Posted by "Luis Fco. Ramirez Daza Gonzalez" <lu...@yahoo.com.mx>.
Hi Michael

I'm not sure if I have latest version from the trunk. I'll check that right now.

The error is:
"Lucene.Net.Store.AlreadyClosedException: this Directory is closed
   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246
   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389
   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623
   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476
   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235
   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491
   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"


>From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.
And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

I'll try to write a function to reproduce the problem.

Thanks in advance for your help.

Saludos, 
Luis

-----Original Message-----
From: Michael Garski [mailto:mgarski@myspace-inc.com] 
Sent: Thursday, October 15, 2009 12:42 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Luis,

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

Michael

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 
Sent: Wednesday, October 14, 2009 7:13 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi George

I just want to know the status of the 2.9 port.

I'm thinking of trying it because we are using 2.4 and I think we are
hitting a bug with the Reopen method.
I was looking for a solution and found a thread in the Java JIRA that says
the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with
a patch:
https://issues.apache.org/jira/browse/LUCENE-1453

The reopen function is very important for us because we update the index
very often, and right now we have to Close + Open each time we update the
index, and because we use custom sort field, we also need to warm up each
time we Close+Open, and all that seems to be solved with the Reopen. 

Thanks

Best regards
Luis

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: Wednesday, September 16, 2009 9:32 PM
To: lucene-net-dev@incubator.apache.org;
lucene-net-user@incubator.apache.org
Subject: Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George






RE: Port of Java Lucene 2.9 is under way

Posted by "Luis Fco. Ramirez Daza Gonzalez" <lu...@yahoo.com.mx>.
Hi Michael

I'm not sure if I have latest version from the trunk. I'll check that right now.

The error is:
"Lucene.Net.Store.AlreadyClosedException: this Directory is closed
   at Lucene.Net.Store.Directory.EnsureOpen() in G:\Projects\Code\LN_2_4_0\src\LN\Store\Directory.cs:line 246
   at Lucene.Net.Store.FSDirectory.List() in G:\Projects\Code\LN_2_4_0\src\LN\Store\FSDirectory.cs:line 389
   at Lucene.Net.Index.SegmentInfos.FindSegmentsFile.Run() in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 623
   at Lucene.Net.Index.SegmentInfos.ReadCurrentVersion(Directory directory) in G:\Projects\Code\LN_2_4_0\src\LN\Index\SegmentInfos.cs:line 476
   at Lucene.Net.Index.DirectoryIndexReader.IsCurrent() in G:\Projects\Code\LN_2_4_0\src\LN\Index\DirectoryIndexReader.cs:line 235
   at TextIndexLucene.TIdxLucene.TIdxL.IsCurrent() in G:\Projects\Code\TextIndexLucene\TxtIdxL.vb:line 3491
   at TextIndexLuceneTestBed.frmMain.DoSearch() in G:\Projects\Code\TextIndexLuceneTestBed\frmMain.vb:line 2201"


>From what I read from the post in the Lucene-Java and from debugging, the problem is that the Directory/FSDirectory are being closed recursively, and it eventually closes all Directories and resets all ref count to 0.
And as I undertand from the post is happens when you create the Reader/Searcher using a string "NEW Reader("c:\indexfolder\")" and later you reopen the index using a Directory (FSDirectory for example), it calls DecRef() recursively until it reaches 0. And later when I call IsCurrent() it throws -AlreadyClosedException("this IndexReader is closed")- when EnsureOpen() is called because the refCount is <=0.

I'll try to write a function to reproduce the problem.

Thanks in advance for your help.

Saludos, 
Luis

-----Original Message-----
From: Michael Garski [mailto:mgarski@myspace-inc.com] 
Sent: Thursday, October 15, 2009 12:42 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Luis,

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

Michael

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 
Sent: Wednesday, October 14, 2009 7:13 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi George

I just want to know the status of the 2.9 port.

I'm thinking of trying it because we are using 2.4 and I think we are
hitting a bug with the Reopen method.
I was looking for a solution and found a thread in the Java JIRA that says
the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with
a patch:
https://issues.apache.org/jira/browse/LUCENE-1453

The reopen function is very important for us because we update the index
very often, and right now we have to Close + Open each time we update the
index, and because we use custom sort field, we also need to warm up each
time we Close+Open, and all that seems to be solved with the Reopen. 

Thanks

Best regards
Luis

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: Wednesday, September 16, 2009 9:32 PM
To: lucene-net-dev@incubator.apache.org;
lucene-net-user@incubator.apache.org
Subject: Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George






RE: Port of Java Lucene 2.9 is under way

Posted by Michael Garski <mg...@myspace-inc.com>.
Luis,

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

Michael

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 
Sent: Wednesday, October 14, 2009 7:13 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi George

I just want to know the status of the 2.9 port.

I'm thinking of trying it because we are using 2.4 and I think we are
hitting a bug with the Reopen method.
I was looking for a solution and found a thread in the Java JIRA that says
the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with
a patch:
https://issues.apache.org/jira/browse/LUCENE-1453

The reopen function is very important for us because we update the index
very often, and right now we have to Close + Open each time we update the
index, and because we use custom sort field, we also need to warm up each
time we Close+Open, and all that seems to be solved with the Reopen. 

Thanks

Best regards
Luis

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: Wednesday, September 16, 2009 9:32 PM
To: lucene-net-dev@incubator.apache.org;
lucene-net-user@incubator.apache.org
Subject: Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George




RE: Port of Java Lucene 2.9 is under way

Posted by Michael Garski <mg...@myspace-inc.com>.
Luis,

What issue are you having with the IndexReader.Reopen() method?  We use it for the same reasons you are and do not have any issues with it using the latest version in the trunk.

Michael

-----Original Message-----
From: Luis Fco. Ramirez Daza Gonzalez [mailto:luis.francisco.rdg@gmail.com] 
Sent: Wednesday, October 14, 2009 7:13 PM
To: lucene-net-user@incubator.apache.org; lucene-net-dev@incubator.apache.org
Subject: RE: Port of Java Lucene 2.9 is under way

Hi George

I just want to know the status of the 2.9 port.

I'm thinking of trying it because we are using 2.4 and I think we are
hitting a bug with the Reopen method.
I was looking for a solution and found a thread in the Java JIRA that says
the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with
a patch:
https://issues.apache.org/jira/browse/LUCENE-1453

The reopen function is very important for us because we update the index
very often, and right now we have to Close + Open each time we update the
index, and because we use custom sort field, we also need to warm up each
time we Close+Open, and all that seems to be solved with the Reopen. 

Thanks

Best regards
Luis

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: Wednesday, September 16, 2009 9:32 PM
To: lucene-net-dev@incubator.apache.org;
lucene-net-user@incubator.apache.org
Subject: Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George




RE: Port of Java Lucene 2.9 is under way

Posted by "Luis Fco. Ramirez Daza Gonzalez" <lu...@gmail.com>.
Hi George

I just want to know the status of the 2.9 port.

I'm thinking of trying it because we are using 2.4 and I think we are
hitting a bug with the Reopen method.
I was looking for a solution and found a thread in the Java JIRA that says
the fix wont be ported back to 2.4, but I think it is solved in 2.9 in with
a patch:
https://issues.apache.org/jira/browse/LUCENE-1453

The reopen function is very important for us because we update the index
very often, and right now we have to Close + Open each time we update the
index, and because we use custom sort field, we also need to warm up each
time we Close+Open, and all that seems to be solved with the Reopen. 

Thanks

Best regards
Luis

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: Wednesday, September 16, 2009 9:32 PM
To: lucene-net-dev@incubator.apache.org;
lucene-net-user@incubator.apache.org
Subject: Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected (a
bug was found in RC4).  My port is based on RC3, but changes between Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George



Re: Port of Java Lucene 2.9 is under way

Posted by Ben Martz <be...@gmail.com>.
Hey George,

I know that we all appreciate you working your tush off on all these  
ports but is there any chance you might find a few moments to work on  
the porting guide we previously discussed so more of us can get  
involved please? This could wait until after the 2.9 port if that's a  
more effective use of time but I really think it would help long-term.  
My offer stands to review, test, proofread and such as needed.

Respectfully,
Ben

On Sep 16, 2009, at 19:32, "George Aroush" <ge...@aroush.net> wrote:

> Hi folks,
>
>
>
> This is to let you know that I have begun the porting process of  
> Java Lucene
> 2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to  
> have an
> early release checked-into SVN.
>
>
>
> If you are following Java Lucene mailing list, you will know that  
> 2.9 is
> currently undergoing release as Release Candidate 4 and RC5 is  
> expected (a
> bug was found in RC4).  My port is based on RC3, but changes between  
> Java
> Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my  
> port.
>
>
>
> With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
> releases very close; my hope is, any further ports should be an  
> accumulation
> of Java Lucene SVN commits ports vs. waiting for a new release to do  
> a chunk
> release.  I'm not sure if this goal can be achieved, but we will see.
>
>
>
> Regards,
>
>
>
> -- George
>

RE: Port of Java Lucene 2.9 is under way

Posted by Dmitri Moore <dm...@colddata.com>.
Thank you, George. Thank you very much. I truly hope you'd be able to
succeed with this goal.

Best,
Dmitri.

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: Wednesday, September 16, 2009 7:32 PM
To: lucene-net-dev@incubator.apache.org;
lucene-net-user@incubator.apache.org
Subject: Port of Java Lucene 2.9 is under way

Hi folks,

 

This is to let you know that I have begun the porting process of Java
Lucene
2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have
an
early release checked-into SVN.

 

If you are following Java Lucene mailing list, you will know that 2.9 is
currently undergoing release as Release Candidate 4 and RC5 is expected
(a
bug was found in RC4).  My port is based on RC3, but changes between
Java
Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.

 

With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
releases very close; my hope is, any further ports should be an
accumulation
of Java Lucene SVN commits ports vs. waiting for a new release to do a
chunk
release.  I'm not sure if this goal can be achieved, but we will see.

 

Regards,

 

-- George


RE: Port of Java Lucene 2.9 is under way

Posted by George Aroush <ge...@aroush.net>.
That's the goal.  After this port, we should be able to grab SVN commits
into Java Lucene and port only those commits over.  Then, the port will be
open to everyone.

-- George

-----Original Message-----
From: Matt Honeycutt [mailto:mbhoneycutt@gmail.com] 
Sent: Wednesday, October 07, 2009 10:36 PM
To: lucene-net-user@incubator.apache.org
Subject: Re: Port of Java Lucene 2.9 is under way

Ouch, that still sounds pretty un-fun.  Maybe one day this project will hit
the point where we can stay on top of the porting manually.

On Wed, Oct 7, 2009 at 9:24 PM, George Aroush <ge...@aroush.net> wrote:

> This question has came up in the past.  You can search the mailing list
for
> my answers.  Here is one,
>
>
http://markmail.org/search/?q=jlca#query:jlca%20from%3A%22George%20Aroush%22
>
+page:1+mid:3wylgpsujl2eyic7+state:results<http://markmail.org/search/?q=jlc
a#query:jlca%20from%3A%22George%20Aroush%22%0A+page:1+mid:3wylgpsujl2eyic7+s
tate:results> and another,
> http://markmail.org/message/i2efusv256ay5oxr.
>
> No, I will never do copy / past / build / test / etc.  JLCA, scripts that
I
> wrote, and deltas are my best friends for porting (free time is not).
>
> -- George
>
>
> -----Original Message-----
> From: Matt Honeycutt [mailto:mbhoneycutt@gmail.com]
> Sent: Wednesday, October 07, 2009 10:09 PM
> To: lucene-net-user@incubator.apache.org
> Subject: Re: Port of Java Lucene 2.9 is under way
>
> This may be an ignorant question, but what does the porting process
> involve?  My limited experience with porting Java to .NET was porting the
> Weka COBWEB clustering algorithm.  My approach there was very brute-force,
> copy-paste, fix errors, build-and-test, and repeat.   I hope there's a
> better way of doing things when dealing with a large port like this. :)
>
> On Wed, Oct 7, 2009 at 9:02 PM, George Aroush <ge...@aroush.net> wrote:
>
> > I'm working on it.  It will be another week or so before I have an alpha
> or
> > beta release.  This is talking me longer than previous ports due to 1)
> > considerable new files are added, 2) a good deal of refactoring was
> > introduced in 2.9.
> >
> > I wish I can divide the work of the initial port, and ask the community
> for
> > help, but that's just not possible due to the way initial ports are
done.
> >
> > -- George
> >
> > -----Original Message-----
> > From: Artem Chereisky [mailto:a.chereisky@gmail.com]
> > Sent: Tuesday, September 29, 2009 8:57 AM
> > To: lucene-net-user@incubator.apache.org
> > Subject: Re: Port of Java Lucene 2.9 is under way
> >
> > Hi guys,
> >
> > where can I find the early release of 2.9 port? Is it going to be under
> > https://svn.apache.org/repos/asf/incubator/lucene.net/?
> >
> > Regards,
> > Art
> >
> >
> >
> >
> > On Thu, Sep 17, 2009 at 12:32 PM, George Aroush <ge...@aroush.net>
> wrote:
> >
> > > Hi folks,
> > >
> > >
> > >
> > > This is to let you know that I have begun the porting process of Java
> > > Lucene
> > > 2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have
> an
> > > early release checked-into SVN.
> > >
> > >
> > >
> > > If you are following Java Lucene mailing list, you will know that 2.9
> is
> > > currently undergoing release as Release Candidate 4 and RC5 is
expected
> > (a
> > > bug was found in RC4).  My port is based on RC3, but changes between
> Java
> > > Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my
port.
> > >
> > >
> > >
> > > With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
> > > releases very close; my hope is, any further ports should be an
> > > accumulation
> > > of Java Lucene SVN commits ports vs. waiting for a new release to do a
> > > chunk
> > > release.  I'm not sure if this goal can be achieved, but we will see.
> > >
> > >
> > >
> > > Regards,
> > >
> > >
> > >
> > > -- George
> > >
> > >
> >
> >
>
>


Re: Port of Java Lucene 2.9 is under way

Posted by Shashi Kant <sh...@gmail.com>.
This too has come up previously - we really need more contributors
(committers) to Lucene.net.

On Wed, Oct 7, 2009 at 10:36 PM, Matt Honeycutt <mb...@gmail.com> wrote:
> the point where we can stay on top of the porting manually.
>

Re: Port of Java Lucene 2.9 is under way

Posted by Matt Honeycutt <mb...@gmail.com>.
Ouch, that still sounds pretty un-fun.  Maybe one day this project will hit
the point where we can stay on top of the porting manually.

On Wed, Oct 7, 2009 at 9:24 PM, George Aroush <ge...@aroush.net> wrote:

> This question has came up in the past.  You can search the mailing list for
> my answers.  Here is one,
>
> http://markmail.org/search/?q=jlca#query:jlca%20from%3A%22George%20Aroush%22
> +page:1+mid:3wylgpsujl2eyic7+state:results<http://markmail.org/search/?q=jlca#query:jlca%20from%3A%22George%20Aroush%22%0A+page:1+mid:3wylgpsujl2eyic7+state:results> and another,
> http://markmail.org/message/i2efusv256ay5oxr.
>
> No, I will never do copy / past / build / test / etc.  JLCA, scripts that I
> wrote, and deltas are my best friends for porting (free time is not).
>
> -- George
>
>
> -----Original Message-----
> From: Matt Honeycutt [mailto:mbhoneycutt@gmail.com]
> Sent: Wednesday, October 07, 2009 10:09 PM
> To: lucene-net-user@incubator.apache.org
> Subject: Re: Port of Java Lucene 2.9 is under way
>
> This may be an ignorant question, but what does the porting process
> involve?  My limited experience with porting Java to .NET was porting the
> Weka COBWEB clustering algorithm.  My approach there was very brute-force,
> copy-paste, fix errors, build-and-test, and repeat.   I hope there's a
> better way of doing things when dealing with a large port like this. :)
>
> On Wed, Oct 7, 2009 at 9:02 PM, George Aroush <ge...@aroush.net> wrote:
>
> > I'm working on it.  It will be another week or so before I have an alpha
> or
> > beta release.  This is talking me longer than previous ports due to 1)
> > considerable new files are added, 2) a good deal of refactoring was
> > introduced in 2.9.
> >
> > I wish I can divide the work of the initial port, and ask the community
> for
> > help, but that's just not possible due to the way initial ports are done.
> >
> > -- George
> >
> > -----Original Message-----
> > From: Artem Chereisky [mailto:a.chereisky@gmail.com]
> > Sent: Tuesday, September 29, 2009 8:57 AM
> > To: lucene-net-user@incubator.apache.org
> > Subject: Re: Port of Java Lucene 2.9 is under way
> >
> > Hi guys,
> >
> > where can I find the early release of 2.9 port? Is it going to be under
> > https://svn.apache.org/repos/asf/incubator/lucene.net/?
> >
> > Regards,
> > Art
> >
> >
> >
> >
> > On Thu, Sep 17, 2009 at 12:32 PM, George Aroush <ge...@aroush.net>
> wrote:
> >
> > > Hi folks,
> > >
> > >
> > >
> > > This is to let you know that I have begun the porting process of Java
> > > Lucene
> > > 2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have
> an
> > > early release checked-into SVN.
> > >
> > >
> > >
> > > If you are following Java Lucene mailing list, you will know that 2.9
> is
> > > currently undergoing release as Release Candidate 4 and RC5 is expected
> > (a
> > > bug was found in RC4).  My port is based on RC3, but changes between
> Java
> > > Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.
> > >
> > >
> > >
> > > With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
> > > releases very close; my hope is, any further ports should be an
> > > accumulation
> > > of Java Lucene SVN commits ports vs. waiting for a new release to do a
> > > chunk
> > > release.  I'm not sure if this goal can be achieved, but we will see.
> > >
> > >
> > >
> > > Regards,
> > >
> > >
> > >
> > > -- George
> > >
> > >
> >
> >
>
>

RE: Port of Java Lucene 2.9 is under way

Posted by George Aroush <ge...@aroush.net>.
This question has came up in the past.  You can search the mailing list for
my answers.  Here is one,
http://markmail.org/search/?q=jlca#query:jlca%20from%3A%22George%20Aroush%22
+page:1+mid:3wylgpsujl2eyic7+state:results  and another,
http://markmail.org/message/i2efusv256ay5oxr. 

No, I will never do copy / past / build / test / etc.  JLCA, scripts that I
wrote, and deltas are my best friends for porting (free time is not).

-- George


-----Original Message-----
From: Matt Honeycutt [mailto:mbhoneycutt@gmail.com] 
Sent: Wednesday, October 07, 2009 10:09 PM
To: lucene-net-user@incubator.apache.org
Subject: Re: Port of Java Lucene 2.9 is under way

This may be an ignorant question, but what does the porting process
involve?  My limited experience with porting Java to .NET was porting the
Weka COBWEB clustering algorithm.  My approach there was very brute-force,
copy-paste, fix errors, build-and-test, and repeat.   I hope there's a
better way of doing things when dealing with a large port like this. :)

On Wed, Oct 7, 2009 at 9:02 PM, George Aroush <ge...@aroush.net> wrote:

> I'm working on it.  It will be another week or so before I have an alpha
or
> beta release.  This is talking me longer than previous ports due to 1)
> considerable new files are added, 2) a good deal of refactoring was
> introduced in 2.9.
>
> I wish I can divide the work of the initial port, and ask the community
for
> help, but that's just not possible due to the way initial ports are done.
>
> -- George
>
> -----Original Message-----
> From: Artem Chereisky [mailto:a.chereisky@gmail.com]
> Sent: Tuesday, September 29, 2009 8:57 AM
> To: lucene-net-user@incubator.apache.org
> Subject: Re: Port of Java Lucene 2.9 is under way
>
> Hi guys,
>
> where can I find the early release of 2.9 port? Is it going to be under
> https://svn.apache.org/repos/asf/incubator/lucene.net/?
>
> Regards,
> Art
>
>
>
>
> On Thu, Sep 17, 2009 at 12:32 PM, George Aroush <ge...@aroush.net> wrote:
>
> > Hi folks,
> >
> >
> >
> > This is to let you know that I have begun the porting process of Java
> > Lucene
> > 2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have
an
> > early release checked-into SVN.
> >
> >
> >
> > If you are following Java Lucene mailing list, you will know that 2.9 is
> > currently undergoing release as Release Candidate 4 and RC5 is expected
> (a
> > bug was found in RC4).  My port is based on RC3, but changes between
Java
> > Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.
> >
> >
> >
> > With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
> > releases very close; my hope is, any further ports should be an
> > accumulation
> > of Java Lucene SVN commits ports vs. waiting for a new release to do a
> > chunk
> > release.  I'm not sure if this goal can be achieved, but we will see.
> >
> >
> >
> > Regards,
> >
> >
> >
> > -- George
> >
> >
>
>


Re: Port of Java Lucene 2.9 is under way

Posted by Matt Honeycutt <mb...@gmail.com>.
This may be an ignorant question, but what does the porting process
involve?  My limited experience with porting Java to .NET was porting the
Weka COBWEB clustering algorithm.  My approach there was very brute-force,
copy-paste, fix errors, build-and-test, and repeat.   I hope there's a
better way of doing things when dealing with a large port like this. :)

On Wed, Oct 7, 2009 at 9:02 PM, George Aroush <ge...@aroush.net> wrote:

> I'm working on it.  It will be another week or so before I have an alpha or
> beta release.  This is talking me longer than previous ports due to 1)
> considerable new files are added, 2) a good deal of refactoring was
> introduced in 2.9.
>
> I wish I can divide the work of the initial port, and ask the community for
> help, but that's just not possible due to the way initial ports are done.
>
> -- George
>
> -----Original Message-----
> From: Artem Chereisky [mailto:a.chereisky@gmail.com]
> Sent: Tuesday, September 29, 2009 8:57 AM
> To: lucene-net-user@incubator.apache.org
> Subject: Re: Port of Java Lucene 2.9 is under way
>
> Hi guys,
>
> where can I find the early release of 2.9 port? Is it going to be under
> https://svn.apache.org/repos/asf/incubator/lucene.net/?
>
> Regards,
> Art
>
>
>
>
> On Thu, Sep 17, 2009 at 12:32 PM, George Aroush <ge...@aroush.net> wrote:
>
> > Hi folks,
> >
> >
> >
> > This is to let you know that I have begun the porting process of Java
> > Lucene
> > 2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
> > early release checked-into SVN.
> >
> >
> >
> > If you are following Java Lucene mailing list, you will know that 2.9 is
> > currently undergoing release as Release Candidate 4 and RC5 is expected
> (a
> > bug was found in RC4).  My port is based on RC3, but changes between Java
> > Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.
> >
> >
> >
> > With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
> > releases very close; my hope is, any further ports should be an
> > accumulation
> > of Java Lucene SVN commits ports vs. waiting for a new release to do a
> > chunk
> > release.  I'm not sure if this goal can be achieved, but we will see.
> >
> >
> >
> > Regards,
> >
> >
> >
> > -- George
> >
> >
>
>

RE: Port of Java Lucene 2.9 is under way

Posted by George Aroush <ge...@aroush.net>.
I'm working on it.  It will be another week or so before I have an alpha or
beta release.  This is talking me longer than previous ports due to 1)
considerable new files are added, 2) a good deal of refactoring was
introduced in 2.9.

I wish I can divide the work of the initial port, and ask the community for
help, but that's just not possible due to the way initial ports are done.

-- George

-----Original Message-----
From: Artem Chereisky [mailto:a.chereisky@gmail.com] 
Sent: Tuesday, September 29, 2009 8:57 AM
To: lucene-net-user@incubator.apache.org
Subject: Re: Port of Java Lucene 2.9 is under way

Hi guys,

where can I find the early release of 2.9 port? Is it going to be under
https://svn.apache.org/repos/asf/incubator/lucene.net/?

Regards,
Art




On Thu, Sep 17, 2009 at 12:32 PM, George Aroush <ge...@aroush.net> wrote:

> Hi folks,
>
>
>
> This is to let you know that I have begun the porting process of Java
> Lucene
> 2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
> early release checked-into SVN.
>
>
>
> If you are following Java Lucene mailing list, you will know that 2.9 is
> currently undergoing release as Release Candidate 4 and RC5 is expected (a
> bug was found in RC4).  My port is based on RC3, but changes between Java
> Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.
>
>
>
> With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
> releases very close; my hope is, any further ports should be an
> accumulation
> of Java Lucene SVN commits ports vs. waiting for a new release to do a
> chunk
> release.  I'm not sure if this goal can be achieved, but we will see.
>
>
>
> Regards,
>
>
>
> -- George
>
>


Re: Port of Java Lucene 2.9 is under way

Posted by Artem Chereisky <a....@gmail.com>.
Hi guys,

where can I find the early release of 2.9 port? Is it going to be under
https://svn.apache.org/repos/asf/incubator/lucene.net/?

Regards,
Art




On Thu, Sep 17, 2009 at 12:32 PM, George Aroush <ge...@aroush.net> wrote:

> Hi folks,
>
>
>
> This is to let you know that I have begun the porting process of Java
> Lucene
> 2.9 to Lucene.Net.  I hope in few weeks (maybe even next week) to have an
> early release checked-into SVN.
>
>
>
> If you are following Java Lucene mailing list, you will know that 2.9 is
> currently undergoing release as Release Candidate 4 and RC5 is expected (a
> bug was found in RC4).  My port is based on RC3, but changes between Java
> Lucene 2.9 RC3 and soon to come RC5 aren't major to side track my port.
>
>
>
> With 2.9 release, we should be able to keep Java Lucene and Lucene.Net
> releases very close; my hope is, any further ports should be an
> accumulation
> of Java Lucene SVN commits ports vs. waiting for a new release to do a
> chunk
> release.  I'm not sure if this goal can be achieved, but we will see.
>
>
>
> Regards,
>
>
>
> -- George
>
>