public interface SearchEntry extends AttributeReadId<Long>
SearchEntry
represents a single content
(file, web-page, etc.) and consists of fields
with the according
metadata. It is either used for indexing (net.sf.mmm.search.indexer.api.SearchIndexer) or
retrieval
.SearchFields
,
SearchHit
Modifier and Type | Field and Description |
---|---|
static String |
FIELD_CREATOR
The name of the "creator" field.
|
static String |
FIELD_CUSTOM_ID
The name of the "cid" field.
|
static String |
FIELD_ID
The name of the "id" field.
|
static String |
FIELD_KEYWORDS
The name of the "keywords" field.
|
static String |
FIELD_LANGUAGE
The name of the "lang" field.
|
static String |
FIELD_SIZE
The name of the "size" field.
|
static String |
FIELD_SOURCE
The name of the "source" field.
|
static String |
FIELD_TEXT
The name of the "text" field.
|
static String |
FIELD_TITLE
The name of the "title" field.
|
static String |
FIELD_TYPE
The name of the "type" field.
|
static String |
FIELD_URI
The name of the "uri" field.
|
Modifier and Type | Method and Description |
---|---|
String |
getCreator()
This method gets the author of this entry.
|
Object |
getCustomId()
This method gets the value of the
custom-ID field . |
Object |
getField(String name)
This method is a generic accessor for fields of this
entry . |
<T> T |
getField(String name,
Class<T> type)
This method is a generic accessor for fields of this
entry with a specific
type . |
String |
getFieldAsString(String name)
This method is a shortcut for
. |
Iterator<String> |
getFieldNames()
This method gets the names of all
fields that are defined (NOT
null ). |
Long |
getId()
This method gets the ID used to identify this object.
|
Long |
getSize()
This method gets the size of the content.
|
String |
getSource()
This method gets the value of the
source field . |
String |
getText()
This method gets the value of the
text field . |
String |
getTitle()
This method gets the value of the
title field . |
String |
getType()
This method gets the value of the
type field . |
String |
getUri()
This method gets the value of the
FIELD_URI . |
static final String FIELD_ID
SearchEntry
is updated in the index. The ID is a Long
value. End-users should never
make any assumptions or interpretation of its value as this is totally implementation specific.getId()
,
Constant Field Valuesstatic final String FIELD_TITLE
static final String FIELD_URI
URL-prefix
of the according
source
. FIELD_CUSTOM_ID
can be used for linking the content and the URI might NOT be set then. However
it is best practice to set the URI anyways (to the URL-suffix containing the UID for linking the
content).getUri()
,
Constant Field Valuesstatic final String FIELD_CUSTOM_ID
ID
this is an optional custom ID given by the user of this
API. It can be in any arbitrary format. While the URI of a content may change (e.g. if the content is
renamed or moved) the UID has to stay untouched and identifies the content for its complete lifetime.getCustomId()
,
Constant Field Valuesstatic final String FIELD_TEXT
getText()
,
Constant Field Valuesstatic final String FIELD_KEYWORDS
static final String FIELD_SIZE
Long
value representing the size in bytes.getSize()
,
Constant Field Valuesstatic final String FIELD_CREATOR
getCreator()
,
Constant Field Valuesstatic final String FIELD_TYPE
getType()
,
Constant Field Valuesstatic final String FIELD_LANGUAGE
static final String FIELD_SOURCE
source
of the content. It is not strictly
required but should always be present in a regular setup. If it is NOT present, the field
URI
has to contain the complete URL to the content.getSource()
,
SearchSource
,
Constant Field ValuesObject getField(String name)
entry
. For the predefine fields
(see FIELD_*
constants like FIELD_TEXT
) there are specific getter methods like
getText()
.name
- is the name
of the
requested field.type
.getField(String, Class)
String getFieldAsString(String name)
getField
(name, String.class)
.name
- is the name
of the
requested field.null
if no field exists for the given
name
.<T> T getField(String name, Class<T> type)
entry
with a specific
type
. String
will always work. Other types have to be compatible to the
field type
(or a
RuntimeException
will be thrown).T
- is the generic type expected for the requested field-value (see parameter type
).name
- is the name
of the
requested field.type
- is the type of the requested field.null
if no field exists for the given
name
.Iterator<String> getFieldNames()
fields
that are defined (NOT
null
).String getUri()
FIELD_URI
.FIELD_URI
Object getCustomId()
custom-ID field
.null
if NOT available.FIELD_CUSTOM_ID
String getTitle()
title field
.FIELD_TITLE
String getCreator()
null
if NOT available.FIELD_CREATOR
String getText()
text field
.FIELD_TEXT
String getType()
type field
.null
if NOT available.FIELD_TYPE
String getSource()
source field
.null
if NOT available.FIELD_SOURCE
Long getSize()
null
if NOT available.FIELD_SIZE
Long getId()
getId
in interface AttributeReadId<Long>
null
if the entry is transient and has not yet been added to
the search-index (made persistent).FIELD_ID
Copyright © 2001–2016 mmm-Team. All rights reserved.