Hi Otis Thanks for your reply. Yes, I just means it's a variable. I guss people can read it. Pls forgive my lazy.
>Anson, > >That's not your real code, is it? Those $ characters in it look incorrect. > >Otis > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . >Simpy -- http://www.simpy.com/ - Tag - Search - Share > >----- Original Message ---- >From: anson <[EMAIL PROTECTED]> >To: java-user@lucene.apache.org >Sent: Monday, April 9, 2007 5:25:57 AM >Subject: How to update index dynamically > > >I have build a blog project under tomcat5.5 with Lucene2.0. >And I want to search my blog by full text, but there is somthing wrong: > >---------------------------------------------- >The project flow: > >(1) On tomcat start I wrote a listener to create a index file if the >index is never created.(It's works well) > > >(2) When I create/update/delete an article on the blog, I wrote a method >to update the index.(It's also works well) > >(3) Then I want to search the new/updated article in the front of my >blog page. But I can't get the new article. But when I restart the >tomcat, I can get the new one that I want. Why. > > >----------------------------------------------- >The index update flow: > >(1) Firsrt I delete the old document in index: > >IndexReader reader = > IndexReader.open($INDEX_DIRECTORY); > >Term term = new Term("INDEX_ID", $entryId); > >if (term != null) { > reader.deleteDocuments(term); >} > >//finally: >reader.close(); > > >(2) Add the article to the index: >// Get the singleton IndexWriter instance >IndexWriter writer = > IndexManager.getInstance().getIndexWriter(); > >// add document >// Document() is method of make Lucene document >writer.addDocument(Document($EntryBean)); > >writer.optimize(); > > >// finally: >writer.close(); > > >Could anybody tell me anything can help me out. Or I made a wrong flow? > > >Best regards. > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]