Package com.yahoo.prelude.fastsearch
Class FastHit
java.lang.Object
com.yahoo.component.provider.FreezableClass
com.yahoo.component.provider.ListenableFreezableClass
com.yahoo.search.result.Hit
com.yahoo.prelude.fastsearch.FastHit
- All Implemented Interfaces:
com.yahoo.component.provider.Freezable
,com.yahoo.component.provider.ListenableFreezable
,com.yahoo.processing.response.Data
,Cloneable
,Comparable<Hit>
A regular hit from a Vespa backend
- Author:
- bratseth, Steinar Knutsen
-
Nested Class Summary
Nested classes/interfaces inherited from class com.yahoo.search.result.Hit
Hit.RawUtf8Consumer
-
Field Summary
Fields inherited from class com.yahoo.search.result.Hit
RANKFEATURES_FIELD, SDDOCNAME_FIELD
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSummary
(DocsumDefinition docsumDef, com.yahoo.data.access.Inspector value) For internal usevoid
Removes all fields of thisint
Compares this hit to another hitfeatures()
Returns values for the features listed in summary-features in the rank profile specified in the query producing this.Returns a modifiable iterator over the fields of thisReturns the keys of the fields of this hit as a modifiable view.fields()
Returns the fields of this as a read-only map.void
forEachField
(BiConsumer<String, Object> consumer) Receive a callback on the given object for each field in this hit.void
forEachFieldAsRaw
(Hit.RawUtf8Consumer consumer) Receive a callback on the given object for each field in this hit, where the callback will provide raw utf-8 byte data for strings whose data is already available at this form.int
Returns the index of the node this hit originated atReturns a field value from this Hit.com.yahoo.document.GlobalId
Returns the global id of this document in the backend node which produced itcom.yahoo.net.URI
getId()
Returns the explicitly set uri if available, returns "index:[source]/[partid]/[id]" otherwiseint
byte[]
protected boolean
Returns whether this field is present in the field map in the parent hitprotected boolean
Returns whether any fields are present in the field map in the parent hitint
hashCode()
Returns the hashCode of this hit: The hashcode of its idboolean
isMeta()
Returns false - this is a concrete hit containing requested contentremoveField
(String name) Removes a field from thisvoid
setDistributionKey
(int distributionKey) Sets the index of the node this hit originated atSets the value of a fieldvoid
setGlobalId
(byte[] globalId) void
setSortData
(byte[] data, Sorting sorting) toString()
Methods inherited from class com.yahoo.search.result.Hit
assignId, buildHitField, clone, close, equals, getDisplayId, getFilled, getQuery, getRelevance, getSearcherSpecificMetaData, getSource, isAuxiliary, isCached, isFillable, isFilled, request, reserve, setAuxiliary, setCached, setFillable, setFilled, setId, setId, setMeta, setQuery, setRelevance, setRelevance, setSearcherSpecificMetaData, setSource, types
Methods inherited from class com.yahoo.component.provider.ListenableFreezableClass
addFreezeListener, freeze
Methods inherited from class com.yahoo.component.provider.FreezableClass
ensureNotFrozen, isFrozen
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.yahoo.component.provider.Freezable
freeze, isFrozen
Methods inherited from interface com.yahoo.component.provider.ListenableFreezable
addFreezeListener
-
Constructor Details
-
FastHit
public FastHit()Creates an empty and temporarily invalid summary hit -
FastHit
public FastHit(byte[] gid, double relevance, int partId, int distributionKey) -
FastHit
-
FastHit
-
-
Method Details
-
isMeta
public boolean isMeta()Returns false - this is a concrete hit containing requested content -
getId
public com.yahoo.net.URI getId()Returns the explicitly set uri if available, returns "index:[source]/[partid]/[id]" otherwise -
getGlobalId
public com.yahoo.document.GlobalId getGlobalId()Returns the global id of this document in the backend node which produced it -
getRawGlobalId
public byte[] getRawGlobalId() -
setGlobalId
public void setGlobalId(byte[] globalId) -
getPartId
public int getPartId() -
getDistributionKey
public int getDistributionKey()Returns the index of the node this hit originated at -
setDistributionKey
public void setDistributionKey(int distributionKey) Sets the index of the node this hit originated at -
setSortData
-
compareTo
Description copied from class:Hit
Compares this hit to another hit- Specified by:
compareTo
in interfaceComparable<Hit>
- Overrides:
compareTo
in classHit
-
addSummary
For internal use -
features
Returns values for the features listed in summary-features in the rank profile specified in the query producing this. -
getField
Returns a field value from this Hit. The value is either a stored value from the Document represented by this Hit, or a generated value added during later processing.
The values available from the matching Document are a subset of the values set in the document, determined by the
filled
status of this Hit. More fields may be requested by requesting further filling.Lookups on names which does not exists in the document and is not added by later processing return null.
Lookups on fields which exist in the document, in a summary class which is already requested filled returns the following types, even when the field has no actual value:
- string and uri fields: A Java String.
The empty string ("") if no value is assigned in the document. - Dynamic summary string fields: A Java String before JuniperSearcher and a HitField after.
- Numerics: The corresponding numeric Java type.
If the field has no value assigned in the document, the special numericNanNumber.NaN
is returned. - raw fields: A
RawData
instance - tensor fields: A
Tensor
instance - multivalue fields: A
Inspector
instance
- string and uri fields: A Java String.
-
setField
Description copied from class:Hit
Sets the value of a field -
forEachField
Description copied from class:Hit
Receive a callback on the given object for each field in this hit. This is more efficient than accessing the fields as a map or iterator.- Overrides:
forEachField
in classHit
-
forEachFieldAsRaw
Description copied from class:Hit
Receive a callback on the given object for each field in this hit, where the callback will provide raw utf-8 byte data for strings whose data is already available at this form. This is the most resource efficient way of traversing all the fields of a hit in renderers which produces utf-8.- Overrides:
forEachFieldAsRaw
in classHit
-
fields
Description copied from class:Hit
Returns the fields of this as a read-only map. This is more costly than fieldIterator() -
fieldIterator
Description copied from class:Hit
Returns a modifiable iterator over the fields of this- Overrides:
fieldIterator
in classHit
-
fieldKeys
Returns the keys of the fields of this hit as a modifiable view. This follows the rules of key sets returned from maps: Key removals are reflected in the map, add and addAll is not supported. -
clearFields
public void clearFields()Removes all fields of this- Overrides:
clearFields
in classHit
-
removeField
Removes a field from this- Overrides:
removeField
in classHit
- Returns:
- the removed value of the field, or null if none
-
hasField
Returns whether this field is present in the field map in the parent hit -
hasFields
protected boolean hasFields()Returns whether any fields are present in the field map in the parent hit -
toString
-
hashCode
public int hashCode()Description copied from class:Hit
Returns the hashCode of this hit: The hashcode of its id
-