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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSummary(DocsumDefinition docsumDef, com.yahoo.data.access.Inspector value) For internal usevoidRemoves all fields of thisintCompares 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.voidforEachField(BiConsumer<String, Object> consumer) Receive a callback on the given object for each field in this hit.voidforEachFieldAsRaw(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.intReturns the index of the node this hit originated atReturns a field value from this Hit.com.yahoo.document.GlobalIdReturns the global id of this document in the backend node which produced itcom.yahoo.net.URIgetId()Returns the explicitly set uri if available, returns "index:[source]/[partid]/[id]" otherwiseintbyte[]protected booleanReturns whether this field is present in the field map in the parent hitprotected booleanReturns whether any fields are present in the field map in the parent hitinthashCode()Returns the hashCode of this hit: The hashcode of its idbooleanisMeta()Returns false - this is a concrete hit containing requested contentremoveField(String name) Removes a field from thisvoidsetDistributionKey(int distributionKey) Sets the index of the node this hit originated atSets the value of a fieldvoidsetGlobalId(byte[] globalId) voidsetSortData(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, typesMethods inherited from class com.yahoo.component.provider.ListenableFreezableClass
addFreezeListener, freezeMethods inherited from class com.yahoo.component.provider.FreezableClass
ensureNotFrozen, isFrozenMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.yahoo.component.provider.Freezable
freeze, isFrozenMethods 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:HitCompares this hit to another hit- Specified by:
compareToin interfaceComparable<Hit>- Overrides:
compareToin 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
filledstatus 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.NaNis returned. - raw fields: A
RawDatainstance - tensor fields: A
Tensorinstance - multivalue fields: A
Inspectorinstance
- string and uri fields: A Java String.
-
setField
Description copied from class:HitSets the value of a field -
forEachField
Description copied from class:HitReceive 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:
forEachFieldin classHit
-
forEachFieldAsRaw
Description copied from class:HitReceive 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:
forEachFieldAsRawin classHit
-
fields
Description copied from class:HitReturns the fields of this as a read-only map. This is more costly than fieldIterator() -
fieldIterator
Description copied from class:HitReturns a modifiable iterator over the fields of this- Overrides:
fieldIteratorin 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:
clearFieldsin classHit
-
removeField
Removes a field from this- Overrides:
removeFieldin 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:HitReturns the hashCode of this hit: The hashcode of its id
-