lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Zimmermann (JIRA)" <j...@apache.org>
Subject [jira] Created: (LUCENENET-327) FSdirectory, Indexwriter
Date Mon, 14 Dec 2009 09:22:18 GMT
FSdirectory, Indexwriter
------------------------

                 Key: LUCENENET-327
                 URL: https://issues.apache.org/jira/browse/LUCENENET-327
             Project: Lucene.Net
          Issue Type: Bug
         Environment: windows xp
            Reporter: Tim Zimmermann


hello, i'm not quit sure whether i'm right here.

i created a website and i want to create an index ( ~once per week)
but somehow the function how to create a index can't  "stand alone" from the search function.




Dim analyzer As StandardAnalyzer = New StandardAnalyzer()
Dim directory As Directory = FSDirectory.GetDirectory("LuceneIndex", True)
Dim indexwriter As IndexWriter = New IndexWriter(directory, analyzer, True)

Sub create_doc() 
        
        Dim mydoc As New Document()
        
        Dim textstring As String =[...]
         ....--> field
        -->mydoc.add(field)
          indexwriter.adddocument)
          indexwriter.close

end sub 

and

Sub lucene_search(ByVal strSuchbegriff As String)
          
          Dim parser As QueryParser = New QueryParser("bodytext", analyzer)  
          Dim query As Query = parser.Parse(strSuchbegriff)
          Dim searcher As IndexSearcher = New IndexSearcher(directory)
            
          Dim hits As Hits = searcher.Search(query)           
          Dim results As Integer = hits.Length()


...
end sub


when both functions are in one function

F()
{
create_doc()
lucene_search(text)
}
it works, and i find the documents

but if i want to create the index once

create_doc()

F()
{
lucene_search(text)
}

it doesn't work
like the indexwriter.adddocument was deleted or something like this.


i would be very amused for some help,
i'm working with lucene ~10 days and it's very rare documented.

greetings tyzak


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message