|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.index.AbstractIndex
org.crosswire.jsword.index.lucene.LuceneIndex
public class LuceneIndex
Implement the SearchEngine using Lucene as the search engine.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
private boolean |
active
Are we active |
protected Book |
book
The Book that we are indexing |
private static Object |
CREATING
A synchronization lock point to prevent us from doing 2 index runs at a time. |
static String |
FIELD_BODY
The Lucene field for the text contents |
static String |
FIELD_HEADING
The Lucene field for headings |
static String |
FIELD_KEY
The Lucene field for the osisID |
static String |
FIELD_NOTE
The Lucene field for the notes |
static String |
FIELD_STRONG
The Lucene field for the strong numbers |
static String |
FIELD_XREF
The Lucene field for cross references |
private static Logger |
log
The log stream |
private String |
path
The location of this index |
protected org.apache.lucene.search.Searcher |
searcher
The Lucene search engine |
Constructor Summary | |
---|---|
LuceneIndex(Book book,
URI storage)
Read an existing index and use it. |
|
LuceneIndex(Book book,
URI storage,
boolean create)
Generate an index to use, telling the job about progress as you go. |
Method Summary | |
---|---|
void |
activate(Lock lock)
Called to indicate that the Book should initialize itself, and consume whatever system resources it needs to be able to respond to other queries. |
private void |
addField(org.apache.lucene.document.Document doc,
org.apache.lucene.document.Field field,
String text)
|
protected void |
checkActive()
Helper method so we can quickly activate ourselves on access |
void |
deactivate(Lock lock)
Called to indicate that the Book should release whatever system resources it can to make way for other uses. |
Key |
find(String search)
Find the set of references that satisfy the query. |
private void |
generateSearchIndexImpl(Progress job,
List errors,
org.apache.lucene.index.IndexWriter writer,
Key key,
int count)
Dig down into a Key indexing as we go. |
Key |
getKey(String name)
An index must be able to create KeyLists for users in a similar way to the Book that it is indexing. |
Methods inherited from class org.crosswire.jsword.index.AbstractIndex |
---|
getSearchModifier, setSearchModifier |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String FIELD_KEY
public static final String FIELD_BODY
public static final String FIELD_STRONG
public static final String FIELD_HEADING
public static final String FIELD_XREF
public static final String FIELD_NOTE
private static final Object CREATING
private boolean active
private static final Logger log
protected Book book
private String path
protected org.apache.lucene.search.Searcher searcher
Constructor Detail |
---|
public LuceneIndex(Book book, URI storage) throws BookException
BookException
- If we fail to read the index filespublic LuceneIndex(Book book, URI storage, boolean create) throws BookException
BookException
- If we fail to read the index filesMethod Detail |
---|
public Key find(String search) throws BookException
Index
query
being searched for is null then an empty Key
MUST be returned. Users of this index may use this functionality
to get empty KeyLists which they then use to aggregate other searches
done on this index.
find
in interface Index
search
- The text to search for
BookException
public Key getKey(String name) throws NoSuchKeyException
Index
getKey
in interface Index
name
- The string to convert to a Key
NoSuchKeyException
- If the string can not be turned into a KeyKeyFactory.getKey(String)
public final void activate(Lock lock)
Activatable
activate
in interface Activatable
lock
- An attempt to ensure that only the Activator calls this methodpublic final void deactivate(Lock lock)
Activatable
deactivate
in interface Activatable
lock
- An attempt to ensure that only the Activator calls this methodprotected final void checkActive()
private void generateSearchIndexImpl(Progress job, List errors, org.apache.lucene.index.IndexWriter writer, Key key, int count) throws BookException, IOException
BookException
IOException
private void addField(org.apache.lucene.document.Document doc, org.apache.lucene.document.Field field, String text)
|
Copyright ยจ 2003-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |