|
Carrot2 v3.3.0
API Documentation |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.carrot2.core.Document
public final class Document
A document that to be processed by the framework. Each document is a collection of
fields carrying different bits of information, e.g. TITLE or
CONTENT_URL.
| Nested Class Summary | |
|---|---|
static class |
Document.DocumentToId
Transforms a Document to its identifier returned by
getId(). |
| Field Summary | |
|---|---|
static Comparator<Document> |
BY_ID_COMPARATOR
Compares Documents by their identifiers getId(), which effectively
gives the original order in which they were returned by the document source. |
static String |
CLICK_URL
Click URL. |
static String |
CONTENT_URL
Field name for an URL pointing to the full version of the document. |
static String |
LANGUAGE
Field name for the language in which the document is written. |
static String |
PARTITIONS
Identifiers of reference clustering partitions this document belongs to. |
static String |
SIZE
Document size. |
static String |
SOURCES
Field name for a list of sources the document was found in. |
static String |
SUMMARY
Field name for a short summary of the document, e.g. |
static String |
THUMBNAIL_URL
Field name for an URL pointing to the thumbnail image associated with the document. |
static String |
TITLE
Field name for the title of the document. |
| Constructor Summary | |
|---|---|
Document()
Creates an empty document with no fields. |
|
Document(String title)
Creates a document with the provided title. |
|
Document(String title,
String summary)
Creates a document with the provided title and summary. |
|
Document(String title,
String summary,
LanguageCode language)
Creates a document with the provided title, summary and
language. |
|
Document(String title,
String summary,
String contentUrl)
Creates a document with the provided title, summary and
contentUrl. |
|
Document(String title,
String summary,
String contentUrl,
LanguageCode language)
Creates a document with the provided title, summary,
contentUrl and language. |
|
| Method Summary | ||
|---|---|---|
static void |
assignDocumentIds(Collection<Document> documents)
Assigns sequential identifiers to the provided documents. |
|
String |
getContentUrl()
Returns this document's CONTENT_URL field. |
|
|
getField(String name)
Returns value of the specified field of this document. |
|
Map<String,Object> |
getFields()
Returns all fields of this document. |
|
Integer |
getId()
A unique identifier of this document. |
|
LanguageCode |
getLanguage()
Returns this document's LANGUAGE. |
|
List<String> |
getSources()
Returns this document's SOURCES field. |
|
String |
getSummary()
Returns this document's SUMMARY field. |
|
String |
getTitle()
Returns this document's TITLE field. |
|
Document |
setContentUrl(String contentUrl)
Sets this document's CONTENT_URL field. |
|
Document |
setField(String name,
Object value)
Sets a field in this document. |
|
Document |
setLanguage(LanguageCode language)
Sets this document's LANGUAGE. |
|
Document |
setSources(List<String> sources)
Sets this document's SOURCES field. |
|
Document |
setSummary(String summary)
Sets this document's SUMMARY field. |
|
Document |
setTitle(String title)
Sets this document's TITLE field. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String TITLE
public static final String SUMMARY
public static final String CONTENT_URL
public static final String CLICK_URL
CONTENT_URL.
public static final String THUMBNAIL_URL
public static final String SIZE
public static final String SOURCES
List<String>
public static final String LANGUAGE
LanguageCode. If the language field is not defined or is
null, it means the language of the document is unknown or it is
outside of the list defined in LanguageCode.
public static final String PARTITIONS
Value type: Collection<Object>. There is no constraint on the
actual type of the partition identifier in the collection. Identifiers are assumed
to correctly implement the Object.equals(Object) and Object.hashCode() methods.
public static final Comparator<Document> BY_ID_COMPARATOR
Documents by their identifiers getId(), which effectively
gives the original order in which they were returned by the document source.
| Constructor Detail |
|---|
public Document()
public Document(String title)
title.
public Document(String title,
String summary)
title and summary.
public Document(String title,
String summary,
LanguageCode language)
title, summary and
language.
public Document(String title,
String summary,
String contentUrl)
title, summary and
contentUrl.
public Document(String title,
String summary,
String contentUrl,
LanguageCode language)
title, summary,
contentUrl and language.
| Method Detail |
|---|
public Integer getId()
public String getTitle()
TITLE field.
public Document setTitle(String title)
TITLE field.
title - title to set
public String getSummary()
SUMMARY field.
public Document setSummary(String summary)
SUMMARY field.
summary - summary to set
public String getContentUrl()
CONTENT_URL field.
public Document setContentUrl(String contentUrl)
CONTENT_URL field.
contentUrl - content URL to set
public List<String> getSources()
SOURCES field.
public Document setSources(List<String> sources)
SOURCES field.
sources - the sources list to set
public LanguageCode getLanguage()
LANGUAGE.
public Document setLanguage(LanguageCode language)
LANGUAGE.
language - the language to set
public Map<String,Object> getFields()
public <T> T getField(String name)
name, null will be returned.
name - of the field to be returned
null
public Document setField(String name,
Object value)
name - of the field to setvalue - value of the field
public static void assignDocumentIds(Collection<Document> documents)
documents. If a
document already has an identifier, the identifier will not be changed.
documents - documents to assign identifiers to.
IllegalArgumentException - if the provided documents contain non-unique
identifiers
|
Please refer to project documentation at
http://project.carrot2.org |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||