net.conquiris.lucene.search
Class Hit

java.lang.Object
  extended by net.conquiris.lucene.search.Hit
All Implemented Interfaces:
Supplier<Document>

public final class Hit
extends Object
implements Supplier<Document>

Object representing a search hit. Public methods never return null.

Author:
Andres Rodriguez

Method Summary
 FieldValues<InputSupplier<ByteArrayInputStream>> binary(String name)
          Returns the values of the binary fields with the given name.
 FieldValues<Boolean> booleanValues(String name)
          Returns the boolean values of the numeric fields with the given name.
 FieldValues<ByteString> byteString(String name)
          Returns the values of the binary fields with the given name.
 FieldValues<Double> doubleValues(String name)
          Returns the double values of the numeric fields with the given name.
 FieldValues<Float> floatValues(String name)
          Returns the float values of the numeric fields with the given name.
 Document get()
          Returns the document.
 int getDocId()
          Returns the document id.
 Multimap<String,String> getFragments()
          Returns the highlight fragments.
 float getScore()
          Returns the score.
 FieldValues<Instant> instant(String name)
          Returns the instant values of the numeric fields with the given name.
 FieldValues<Integer> integerValues(String name)
          Returns the integer values of the numeric fields with the given name.
 FieldValues<InputSupplier<ByteArrayInputStream>> item(BinarySchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<Boolean> item(BooleanSchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<ByteString> item(ByteStringSchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<Double> item(DoubleSchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<Float> item(FloatSchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<Instant> item(InstantSchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<Integer> item(IntegerSchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<Long> item(LongSchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<String> item(TextSchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<UUID> item(UUIDSchemaItem item)
          Returns the values of the fields corresponding to the given schema item.
 FieldValues<Long> longValues(String name)
          Returns the long values of the numeric fields with the given name.
static Hit of(int docId, float score, Document document, Multimap<String,String> fragments)
          Creates a new hit.
 FieldValues<String> strings(String name)
          Returns the string values of the fields with the given name.
 FieldValues<UUID> uuid(String name)
          Returns the values of the UUID fields with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

of

public static Hit of(int docId,
                     float score,
                     Document document,
                     @Nullable
                     Multimap<String,String> fragments)
Creates a new hit.

Parameters:
docId - Document id.
score - Score.
document - Document. Use only documents loaded with an IndexReader or IndexSearcher.
fragments - Highlight fragments.

getDocId

public int getDocId()
Returns the document id.


getScore

public float getScore()
Returns the score.


get

public Document get()
Returns the document. If modified results are undefined.

Specified by:
get in interface Supplier<Document>

getFragments

public Multimap<String,String> getFragments()
Returns the highlight fragments.


integerValues

public FieldValues<Integer> integerValues(String name)
Returns the integer values of the numeric fields with the given name.


longValues

public FieldValues<Long> longValues(String name)
Returns the long values of the numeric fields with the given name.


floatValues

public FieldValues<Float> floatValues(String name)
Returns the float values of the numeric fields with the given name.


doubleValues

public FieldValues<Double> doubleValues(String name)
Returns the double values of the numeric fields with the given name.


booleanValues

public FieldValues<Boolean> booleanValues(String name)
Returns the boolean values of the numeric fields with the given name.


binary

public FieldValues<InputSupplier<ByteArrayInputStream>> binary(String name)
Returns the values of the binary fields with the given name.


byteString

public FieldValues<ByteString> byteString(String name)
Returns the values of the binary fields with the given name.


uuid

public FieldValues<UUID> uuid(String name)
Returns the values of the UUID fields with the given name.


instant

public FieldValues<Instant> instant(String name)
Returns the instant values of the numeric fields with the given name.


strings

public FieldValues<String> strings(String name)
Returns the string values of the fields with the given name. Includes all non-binary fields with the given name.


item

public FieldValues<String> item(TextSchemaItem item)
Returns the values of the fields corresponding to the given schema item. Includes all non-binary fields with the given name.


item

public FieldValues<Integer> item(IntegerSchemaItem item)
Returns the values of the fields corresponding to the given schema item.


item

public FieldValues<Long> item(LongSchemaItem item)
Returns the values of the fields corresponding to the given schema item.


item

public FieldValues<Float> item(FloatSchemaItem item)
Returns the values of the fields corresponding to the given schema item.


item

public FieldValues<Double> item(DoubleSchemaItem item)
Returns the values of the fields corresponding to the given schema item.


item

public FieldValues<Boolean> item(BooleanSchemaItem item)
Returns the values of the fields corresponding to the given schema item.


item

public FieldValues<InputSupplier<ByteArrayInputStream>> item(BinarySchemaItem item)
Returns the values of the fields corresponding to the given schema item.


item

public FieldValues<ByteString> item(ByteStringSchemaItem item)
Returns the values of the fields corresponding to the given schema item.


item

public FieldValues<UUID> item(UUIDSchemaItem item)
Returns the values of the fields corresponding to the given schema item.


item

public FieldValues<Instant> item(InstantSchemaItem item)
Returns the values of the fields corresponding to the given schema item.



Copyright © 2013 Derquinse Projects. All Rights Reserved.