public class SimpleDocument extends Object implements Document
Document
-implementation, suitable for most cases. Uses an ObservableDelegate
to manage its
Observer
s.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
IndexableField s (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
Observer s. |
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)
Observable
Observer
.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)
Observable
Observer
.removeObserver
in interface Observable<Document>
observer
- the Observer
to be removedtrue
if removing the Observer
was successful, false
otherwisepublic void notifyObservers(Observable.Event event)
Observable
Observer
s.notifyObservers
in interface Observable<Document>
event
- an Observable.Event
public Iterable<org.apache.lucene.index.IndexableField> getAdditionalFields()
Document
IndexableField
s (if any) to be added to the
Document
which is being created from this Document
.getAdditionalFields
in interface Document
IndexableField
spublic 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()
Document
Document
.getLanguage
in interface Document
public void setLanguage(String language)
public void setType(String type)
public String getContent()
Document
getContent
in interface Document
public void setContent(String content)
public void setPath(String path)
public void setImage(String image)
public String getDescription()
Document
Document
.getDescription
in interface Document
Document
public void setDescription(String description)
public void setDate(Date date)
public String getName()
Document
Document
.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 Document
public void setFragment(String fragment)
setFragment
in interface Document
public 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–2020 aiticon GmbH. All rights reserved.