org.compass.core.impl
Class DefaultCompassDetachedHits

java.lang.Object
  extended by org.compass.core.impl.AbstractCompassHits
      extended by org.compass.core.impl.DefaultCompassDetachedHits
All Implemented Interfaces:
Serializable, Iterable<CompassHit>, CompassDetachedHits, CompassHitsOperations

public class DefaultCompassDetachedHits
extends AbstractCompassHits
implements CompassDetachedHits

Author:
kimchy
See Also:
Serialized Form

Constructor Summary
DefaultCompassDetachedHits(InternalCompassHits hits, InternalCompassSession session, int from, int size, CompassQuery query, CompassQuery suggestedQuery)
           
 
Method Summary
 Object data(int n)
          Returns the object that maps the n'th hit
 Object[] getDatas()
          Returns all the Objects data as an array.
 CompassHit[] getHits()
          Returns all the CompassHits data as an array.
 int getLength()
          Returns the number of hits,
 CompassQuery getQuery()
          Retrurn the query that resulted in this search hits.
 Resource[] getResources()
          Returns all the Resources as an array.
 CompassQuery getSuggestedQuery()
          Returns a suggested query (based on spell check).
 int getTotalLength()
          Returns the total number of hits (not just the detached ones).
 CompassHighlightedText highlightedText(int n)
          Returns a cached highlighted text the maps to the n'th hit.
 CompassHit hit(int n)
          Returns a compass hit wrapper that maps to the n'th hit
 Resource resource(int n)
          Returns the resource that maps to the n'th hit
 float score(int n)
          Returns the score of the n'th hit.
 int totalLength()
          Returns the total number of hits (not just the detached ones).
 
Methods inherited from class org.compass.core.impl.AbstractCompassHits
iterator, length
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.compass.core.CompassHitsOperations
length
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

DefaultCompassDetachedHits

public DefaultCompassDetachedHits(InternalCompassHits hits,
                                  InternalCompassSession session,
                                  int from,
                                  int size,
                                  CompassQuery query,
                                  CompassQuery suggestedQuery)
                           throws CompassException,
                                  IllegalArgumentException
Throws:
CompassException
IllegalArgumentException
Method Detail

getQuery

public CompassQuery getQuery()
Description copied from interface: CompassHitsOperations
Retrurn the query that resulted in this search hits.

Specified by:
getQuery in interface CompassHitsOperations

getSuggestedQuery

public CompassQuery getSuggestedQuery()
Description copied from interface: CompassHitsOperations
Returns a suggested query (based on spell check).

Specified by:
getSuggestedQuery in interface CompassHitsOperations
See Also:
CompassQuery.getSuggestedQuery()

score

public float score(int n)
            throws CompassException,
                   IllegalArgumentException
Description copied from interface: CompassHitsOperations
Returns the score of the n'th hit. Can be a value between 0 and 1, normalised by the highest scoring hit.

Specified by:
score in interface CompassHitsOperations
Parameters:
n - The n'th hit.
Returns:
The score.
Throws:
CompassException
IllegalArgumentException

resource

public Resource resource(int n)
                  throws CompassException,
                         IllegalArgumentException
Description copied from interface: CompassHitsOperations
Returns the resource that maps to the n'th hit

Specified by:
resource in interface CompassHitsOperations
Parameters:
n - The n'th hit.
Returns:
The resource.
Throws:
CompassException
IllegalArgumentException

data

public Object data(int n)
            throws CompassException,
                   IllegalArgumentException
Description copied from interface: CompassHitsOperations
Returns the object that maps the n'th hit

Specified by:
data in interface CompassHitsOperations
Parameters:
n - The n'th hit.
Returns:
The object.
Throws:
CompassException
IllegalArgumentException

highlightedText

public CompassHighlightedText highlightedText(int n)
                                       throws CompassException
Description copied from interface: CompassHitsOperations
Returns a cached highlighted text the maps to the n'th hit.

Highlighted text is automatically cached when using CompassHighlighter using CompassHits.highlighter(int).

Specified by:
highlightedText in interface CompassHitsOperations
Parameters:
n - The n'th hit
Returns:
A highlighted text cache associated witht the n'th hit
Throws:
CompassException

hit

public CompassHit hit(int n)
               throws CompassException
Description copied from interface: CompassHitsOperations
Returns a compass hit wrapper that maps to the n'th hit

Specified by:
hit in interface CompassHitsOperations
Parameters:
n - The n'th hit.
Returns:
The hit.
Throws:
CompassException

getLength

public int getLength()
Description copied from interface: CompassHitsOperations
Returns the number of hits,

Specified by:
getLength in interface CompassHitsOperations
Returns:
The number of hits.

getTotalLength

public int getTotalLength()
Description copied from interface: CompassDetachedHits
Returns the total number of hits (not just the detached ones).

Specified by:
getTotalLength in interface CompassDetachedHits
Returns:
The total number of hits.

totalLength

public int totalLength()
Description copied from interface: CompassDetachedHits
Returns the total number of hits (not just the detached ones).

Specified by:
totalLength in interface CompassDetachedHits
Returns:
The total number of hits.

getResources

public Resource[] getResources()
                        throws CompassException
Description copied from interface: CompassDetachedHits
Returns all the Resources as an array.

Specified by:
getResources in interface CompassDetachedHits
Returns:
All the Resources as an array
Throws:
CompassException

getDatas

public Object[] getDatas()
                  throws CompassException
Description copied from interface: CompassDetachedHits
Returns all the Objects data as an array.

Specified by:
getDatas in interface CompassDetachedHits
Returns:
An array of all the hits as objects.
Throws:
CompassException

getHits

public CompassHit[] getHits()
                     throws CompassException
Description copied from interface: CompassDetachedHits
Returns all the CompassHits data as an array.

Specified by:
getHits in interface CompassDetachedHits
Returns:
An array of all the hits.
Throws:
CompassException
See Also:
CompassHit


Copyright (c) 2004-2008 The Compass Project.