com.mysema.query.lucene.session
Interface LuceneSession

All Known Implementing Classes:
LuceneSessionImpl

public interface LuceneSession


Method Summary
 LuceneWriter beginAppend()
          Adds documents to index.
 LuceneWriter beginReset()
          Resets the whole index and starts new writer.
 void close()
          Closes the session.
 LuceneQuery createQuery()
          Creates a new query.
 void flush()
          Flushes all data writer has changed.
 

Method Detail

createQuery

LuceneQuery createQuery()
Creates a new query.

Returns:
LuceneQuery instance
Throws:
SessionClosedException - if session is closed

beginAppend

LuceneWriter beginAppend()
Adds documents to index. Creates a new index if the index is not available.

Returns:
LuceneWriter instance
Throws:
SessionReadOnlyException - if session is opened in read-only mode
SessionClosedException - if session is closed

beginReset

LuceneWriter beginReset()
Resets the whole index and starts new writer. Old readers will still see the index as it was when they were opened but new readers will see only the data this writer has committed.

Returns:
LuceneWriter instance
Throws:
SessionReadOnlyException - if session is opened in read-only mode
SessionClosedException - if session is closed

flush

void flush()
Flushes all data writer has changed. Queries created after this will see the new index. Queries created before, will see the old snapshot.

Throws:
SessionClosedException - if session is closed

close

void close()
Closes the session. All writes are committed and resources are cleared. This should always be called in finally block if this session was created explicitly by calling session factory's openSession

Throws:
SessionClosedException - if session is closed


Copyright © 2007-2010 Mysema Ltd. All Rights Reserved.