public class SimpleDocument extends Object implements Document
Document-implementation, suitable for most cases. Uses an ObservableDelegate to manage its
Observers.Observable.Event| Modifier and Type | Field and Description |
|---|---|
static org.apache.commons.lang3.time.FastDateFormat |
DATEFORMAT |
CREATE, DELETE, FIELD_CONTENT, FIELD_DATE, FIELD_ID, FIELD_IMAGE, FIELD_LANGUAGE, FIELD_PATH, FIELD_TEASER, FIELD_TITLE, FIELD_TYPE, UPDATE, YYYY_MM_DD_HH_MM_SS| Constructor and Description |
|---|
SimpleDocument() |
SimpleDocument(float score) |
| Modifier and Type | Method and Description |
|---|---|
void |
addField(org.apache.lucene.index.IndexableField field) |
boolean |
addObserver(Observer<? super Document> observer)
Adds an
Observer. |
int |
compareTo(Document other) |
static SimpleDocument |
extract(org.apache.lucene.document.Document doc,
int docId,
float score) |
Iterable<org.apache.lucene.index.IndexableField> |
getAdditionalFields()
Returns some additionally
IndexableFields (if any) to be added to the
Document which is being created from this Document. |
String |
getContent()
Returns the content to be indexed.
|
Date |
getDate()
|
String |
getDescription()
Returns the description of this
Document. |
int |
getDocId() |
org.apache.lucene.index.IndexableField |
getField(String name) |
String |
getFragment() |
String |
getId()
|
String |
getImage() |
String |
getLanguage()
Returns the language of this
Document. |
String |
getName()
Returns the name of this
Document. |
protected static Number |
getNumberFromField(org.apache.lucene.document.Document doc,
String name,
List<org.apache.lucene.index.IndexableField> fieldsList) |
Observable<Document> |
getObservable() |
String |
getPath()
|
float |
getScore() |
String |
getType()
|
void |
notifyObservers(Observable.Event event)
Notifies the
Observers. |
boolean |
removeObserver(Observer<? super Document> observer)
Removes an
Observer. |
void |
setContent(String content) |
void |
setDate(Date date) |
void |
setDescription(String description) |
void |
setDocId(int docId) |
static void |
setFragment(SimpleDocument doc,
String field,
org.apache.lucene.analysis.Analyzer analyzer,
org.apache.lucene.search.Query query,
String highlightWith) |
void |
setFragment(String fragment) |
void |
setFragment(String field,
org.apache.lucene.analysis.Analyzer analyzer,
org.apache.lucene.search.Query query,
String highlightWith) |
void |
setId(String id) |
void |
setImage(String image) |
void |
setLanguage(String language) |
void |
setName(String name) |
void |
setObservable(Observable<Document> observable) |
void |
setPath(String path) |
void |
setScore(float score) |
void |
setType(String type) |
public SimpleDocument()
public SimpleDocument(float score)
public boolean addObserver(Observer<? super Document> observer)
ObservableObserver.addObserver in interface Observable<Document>observer - the Observer to be addedtrue if adding the Observer was successful, false otherwisepublic boolean removeObserver(Observer<? super Document> observer)
ObservableObserver.removeObserver in interface Observable<Document>observer - the Observer to be removedtrue if removing the Observer was successful, false otherwisepublic void notifyObservers(Observable.Event event)
ObservableObservers.notifyObservers in interface Observable<Document>event - an Observable.Eventpublic Iterable<org.apache.lucene.index.IndexableField> getAdditionalFields()
DocumentIndexableFields (if any) to be added to the
Document which is being created from this Document.getAdditionalFields in interface DocumentIndexableFieldspublic void addField(org.apache.lucene.index.IndexableField field)
public org.apache.lucene.index.IndexableField getField(String name)
public Observable<Document> getObservable()
public void setObservable(Observable<Document> observable)
public String getLanguage()
DocumentDocument.getLanguage in interface Documentpublic void setLanguage(String language)
public void setType(String type)
public String getContent()
DocumentgetContent in interface Documentpublic void setContent(String content)
public void setPath(String path)
public void setImage(String image)
public String getDescription()
DocumentDocument.getDescription in interface DocumentDocumentpublic void setDescription(String description)
public void setDate(Date date)
public String getName()
DocumentDocument.public void setName(String name)
public void setId(String id)
public void setDocId(int docId)
public void setScore(float score)
public String getFragment()
getFragment in interface Documentpublic void setFragment(String fragment)
setFragment in interface Documentpublic int compareTo(Document other)
compareTo in interface Comparable<Document>public static SimpleDocument extract(org.apache.lucene.document.Document doc, int docId, float score)
protected static Number getNumberFromField(org.apache.lucene.document.Document doc, String name, List<org.apache.lucene.index.IndexableField> fieldsList)
public void setFragment(String field, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.search.Query query, String highlightWith)
public static void setFragment(SimpleDocument doc, String field, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.search.Query query, String highlightWith)
Copyright © 2011–2022 aiticon GmbH. All rights reserved.