[jsword-svn]
jsword/java/jsword/org/crosswire/jsword/book/search/lucene s
jswordcvs at crosswire.org
jswordcvs at crosswire.org
Wed Mar 23 05:53:33 MST 2005
Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene
In directory www.crosswire.org:/tmp/cvs-serv2529/java/jsword/org/crosswire/jsword/book/search/lucene
Modified Files:
LuceneIndex.java
Log Message:
Fixed the performance problem of indexing a single testament.
Fixed the problem of BookExceptions being thrown during indexing causing a corrupt index.
Index: LuceneIndex.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/LuceneIndex.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** LuceneIndex.java 22 Mar 2005 12:40:03 -0000 1.10
--- LuceneIndex.java 23 Mar 2005 12:53:30 -0000 1.11
***************
*** 3,7 ****
import java.io.File;
import java.io.IOException;
- import java.io.Reader;
import java.io.StringReader;
import java.net.URL;
--- 3,6 ----
***************
*** 246,249 ****
--- 245,250 ----
private void generateSearchIndexImpl(Job job, IndexWriter writer, Key key) throws BookException, IOException
{
+ int bookNum = 0;
+ int oldBookNum = -1;
int percent = 0;
for (Iterator it = key.iterator(); it.hasNext(); )
***************
*** 256,268 ****
else
{
! BookData data = book.getData(subkey);
! String text = data.getPlainText();
! Reader reader = new StringReader(text);
! Document doc = new Document();
! doc.add(Field.UnIndexed(FIELD_NAME, subkey.getOSISName()));
! doc.add(Field.Text(FIELD_BODY, reader));
! writer.addDocument(doc);
// report progress
--- 257,282 ----
else
{
! BookData data = null;
! try
! {
! data = book.getData(subkey);
! }
! catch (BookException e)
! {
! // ignore
! // TODO(DM): report these to the user as verses that could not be indexed.
! continue;
! }
! String text = data.getPlainText();
! // Do the actual indexing
! if (text != null && text.length() > 0)
! {
! Document doc = new Document();
! doc.add(Field.UnIndexed(FIELD_NAME, subkey.getOSISName()));
! doc.add(Field.Text(FIELD_BODY, new StringReader(text)));
! writer.addDocument(doc);
! }
// report progress
***************
*** 273,277 ****
{
percent = 95 * verse.getOrdinal() / BibleInfo.versesInBible();
! name = BibleInfo.getLongBookName(verse.getBook());
}
catch (NoSuchVerseException ex)
--- 287,296 ----
{
percent = 95 * verse.getOrdinal() / BibleInfo.versesInBible();
! bookNum = verse.getBook();
! if (oldBookNum != bookNum)
! {
! name = BibleInfo.getLongBookName(bookNum);
! oldBookNum = bookNum;
! }
}
catch (NoSuchVerseException ex)
More information about the jsword-svn
mailing list