lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Halácsy Péter <halacsy.pe...@axelero.com>
Subject RE: A question about indexing
Date Wed, 07 Aug 2002 13:44:33 GMT
see IndexReader.indexExists in the API doc or try this:
        m_index = new File(indexPath);
        if(!m_index.exists()) {
            if(!m_index.mkdirs()) {
                throw new IOException("can't create directory " + m_index);
            }
        }
        
        // maybe there is an empty directory (no index in it)
        if(!IndexReader.indexExists(m_index)) {
            // create an empty index
            IndexWriter iw = new IndexWriter(m_index, m_analyzer, true);
            iw.close();
        }

in your code you can:
IndexWriter iw = new IndexWriter(m_index, m_analyzer, false);

peter


> -----Original Message-----
> From: karimi hadi [mailto:karimi_hadi@yahoo.com]
> Sent: Wednesday, August 07, 2002 3:15 PM
> To: Lucene Users List; nsh@bayt.net
> Subject: RE: A question about indexing 
> 
> 
>  Thanks Nader Henein. 
>  But ....
>  I want to run my Program (with One IndexWriter)for 
>  index a ducument and one minute later run my program 
>  again and index other document in Previous  
>  FSDirectory. IS it Possible ?
> 
> 
> --- "Nader S. Henein" <nsh@bayt.net> wrote:
> > That's how Lucene indexes, I guess what you're doing
> > is you're
> > initializing the index writer every time you want to
> > add a file
> > witch would delete the previously existing index.
> > Make sure you only
> > initialize the index writer ex:
> > writer = new IndexWriter(indexPath,Analyzer,true);
> > only in the beginning when you're first creating the
> > index
> > 
> > Nader Henein
> > 
> > -----Original Message-----
> > From: karimi hadi [mailto:karimi_hadi@yahoo.com]
> > Sent: Wednesday, August 07, 2002 4:16 PM
> > To: lucene-user@jakarta.apache.org
> > Subject: A question about indexing
> > 
> > 
> > I want to index some documents with lucene in one
> > FSDirectory. I want to do it in defferent sessions.
> > In each try, Lucene overwrites the older data in the
> > FSDirectory.
> > I want to index my documents in the incremental
> > manner
> > that it seems to be not an unusual approach.
> > 
> > Is it possible to use Lucene in this way? If yes,
> > How
> > I can do it ?
> > 
> > Best Regards.
> > Hadi .
> > 
> > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Health - Feel better, live better
> > http://health.yahoo.com
> > 
> > --
> > To unsubscribe, e-mail:
> > <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:lucene-user-help@jakarta.apache.org>
> > 
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> > <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:lucene-user-help@jakarta.apache.org>
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
> --
> To unsubscribe, e-mail:   
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:lucene-user-help@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message