public class SearchDocument extends Object implements Iterable<SearchField>, Cloneable, Externalizable
Constructor and Description |
---|
SearchDocument()
Construct a new SearchDocument.
|
SearchDocument(String id)
Construct a new SearchDocument with an
id . |
Modifier and Type | Method and Description |
---|---|
void |
addChildDocument(SearchDocument value)
Add a child document.
|
void |
addValue(String field,
Boolean value)
Add a
Boolean value to field . |
void |
addValue(String field,
Date value)
Add a
Date value to field . |
void |
addValue(String field,
Number value)
Add a
numeric value to field . |
void |
addValue(String field,
Point value)
Add a
Point value to field . |
void |
addValue(String field,
SearchFieldValue value)
Add a
value to field . |
void |
addValue(String field,
Shape value)
Add a
Shape value to field . |
void |
addValue(String field,
String value)
Add a
String value to field . |
void |
addValues(String field,
Boolean... values)
|
void |
addValues(String field,
Date... values)
|
void |
addValues(String field,
Number... values)
|
void |
addValues(String field,
Point... values)
|
void |
addValues(String field,
Shape... values)
|
void |
addValues(String field,
String... values)
|
void |
clear()
Remove all fields and child documents.
|
SearchDocument |
clone() |
boolean |
containsChildDocuments()
Get if this document contains child records.
|
boolean |
containsField(String field)
Get if this document contains
field . |
boolean |
equals(Object other) |
SearchDocument |
getChildDocument(int index)
Get a child document by
index . |
int |
getChildDocumentCount()
Get the number of attached child documents.
|
Iterable<SearchDocument> |
getChildDocuments()
Get all of the available child documents.
|
RelevancyFeatureVector |
getFeatures()
Get the feature vector for relevancy components.
|
SearchField |
getField(String field)
Get a
field or null if field does not exist. |
Iterable<String> |
getFieldNames()
Return an
Iterable for iterating over all unique field names. |
SearchFieldValue |
getFirstValue(String field)
Get the first
SearchFieldValue for field or null if the field does not exist. |
String |
getId()
The unique document id.
|
float |
getScore()
Get the document's score.
|
long |
getTotalChildren()
Get the total number of child documents available or
-1 if this count is not known or was not calculated. |
String |
getZone()
Get the zone this document is in
|
int |
hashCode() |
Iterator<SearchField> |
iterator()
Get an iterator for iterating over all
fields . |
void |
readExternal(ObjectInput in) |
void |
removeField(String field)
Remove a
field from the document. |
void |
renameField(String oldName,
String newName)
Rename a field.
|
void |
setChildDocuments(Iterable<SearchDocument> value)
Set the child documents.
|
void |
setChildDocuments(SearchDocument... value)
Set the child documents.
|
void |
setFeatures(RelevancyFeatureVector value)
Set the feature vector for relevancy components.
|
void |
setField(SearchField field)
Set a
field for this document. |
void |
setTotalChildren(long value)
Set the total number of child documents available.
|
int |
size()
Get the number of fields in this document.
|
String |
toString() |
protected void |
toString(StringBuilder buffer,
int depth) |
void |
writeExternal(ObjectOutput out) |
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public SearchDocument()
public SearchDocument(String id)
id
.public String getId()
NOTE: the document id may not be populated for SearchDocuments if not requested. If not populated, an empty string will be returned.
public String getZone()
NOTE: the zone name may not be populated for SearchDocuments if not requested. If not populated, null will be returned.
public RelevancyFeatureVector getFeatures()
public void setFeatures(RelevancyFeatureVector value)
public float getScore()
NOTE: May return 0.0f
if no score was computed, or if score was requested with custom field name.
IllegalArgumentException
- if field named FieldNames.SCORE
contains non-numeric values.public int size()
public Iterable<String> getFieldNames()
Iterable
for iterating over all unique field names.public Iterator<SearchField> iterator()
fields
.iterator
in interface Iterable<SearchField>
public boolean containsField(String field)
field
.public SearchField getField(String field)
field
or null if field
does not exist.
NOTE: if the field exists, but contains no field values, null
will be returned.
public void setField(SearchField field)
field
for this document.
If a field already exists with the same name, it will be replaced.
public SearchFieldValue getFirstValue(String field)
SearchFieldValue
for field
or null if the field does not exist.public void renameField(String oldName, String newName)
If the field does not exist no action is taken.
public void removeField(String field)
field
from the document.public void clear()
public void addValue(String field, SearchFieldValue value)
value
to field
.public long getTotalChildren()
-1
if this count is not known or was not calculated.
NOTE: the is the total number of possible child documents. Use getChildDocumentCount()
to get the actual
number of child documents returned with this SearchDocument.
public void setTotalChildren(long value)
public boolean containsChildDocuments()
public int getChildDocumentCount()
public SearchDocument getChildDocument(int index)
index
.IndexOutOfBoundsException
- if child document at index
is not available.public Iterable<SearchDocument> getChildDocuments()
public void setChildDocuments(SearchDocument... value)
public void setChildDocuments(Iterable<SearchDocument> value)
public void addChildDocument(SearchDocument value)
protected void toString(StringBuilder buffer, int depth)
public SearchDocument clone()
public void readExternal(ObjectInput in) throws IOException
readExternal
in interface Externalizable
IOException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.