org.compass.core.impl
Class DefaultCompassQuery

java.lang.Object
  extended by org.compass.core.impl.DefaultCompassQuery
All Implemented Interfaces:
CompassQuery
Direct Known Subclasses:
DefaultCompassQuery.DefaultCompassSpanQuey

public class DefaultCompassQuery
extends Object
implements CompassQuery

Author:
kimchy

Nested Class Summary
static class DefaultCompassQuery.DefaultCompassSpanQuey
           
 
Nested classes/interfaces inherited from interface org.compass.core.CompassQuery
CompassQuery.CompassSpanQuery, CompassQuery.SortDirection, CompassQuery.SortImplicitType, CompassQuery.SortPropertyType
 
Constructor Summary
DefaultCompassQuery(SearchEngineQuery searchEngineQuery, InternalCompassSession session)
           
 
Method Summary
 CompassQuery addSort(CompassQuery.SortImplicitType implicitType)
          Adds sorting on implicit types, which are not direct properties values.
 CompassQuery addSort(CompassQuery.SortImplicitType implicitType, CompassQuery.SortDirection direction)
          Adds sorting on implicit types, which are not direct properties values.
 CompassQuery addSort(String name)
          Adds sorting on the given property name.
 CompassQuery addSort(String name, CompassQuery.SortDirection direction)
          Adds sorting on the given property name.
 CompassQuery addSort(String name, CompassQuery.SortPropertyType type)
          Adds sorting on the given property name, and using the given property type.
 CompassQuery addSort(String name, CompassQuery.SortPropertyType type, CompassQuery.SortDirection direction)
          Adds sorting on the given property name, and using the given property type.
 CompassQueryFilter getFilter()
          Returns the filter set using CompassQuery.setFilter(CompassQueryFilter).
 SearchEngineQuery getSearchEngineQuery()
           
 CompassHits hits()
          Performs the search and returns the hits that match the qeury.
 CompassQuery setAliases(String[] aliases)
          Narrows down the query to be executed only against the given aliases.
 CompassQuery setBoost(float boost)
          Sets the boost for this query to boost.
 CompassQuery setFilter(CompassQueryFilter filter)
          Sets a filter to the query.
 CompassQuery setSubIndexes(String[] subIndexes)
          Narrows down the query to be executed only against the given sub indexes.
 CompassQuery setTypes(Class[] types)
          Narrows down the query to be executed only against the given types.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultCompassQuery

public DefaultCompassQuery(SearchEngineQuery searchEngineQuery,
                           InternalCompassSession session)
Method Detail

setBoost

public CompassQuery setBoost(float boost)
Description copied from interface: CompassQuery
Sets the boost for this query to boost. Hits matching this query will (in addition to the normal weightings) have their score multiplied by boost.

Specified by:
setBoost in interface CompassQuery

addSort

public CompassQuery addSort(String name)
Description copied from interface: CompassQuery
Adds sorting on the given property name. The type of sorting will be identified automatically (though it is preferable to specify it in advance using the CompassQuery.addSort(String,SortPropertyType).

Note that the property must be UN_TOKENIZED, and stored.

Note, that the sort option will only work on the outer most query (i.e. the one that the hits is called on).

Specified by:
addSort in interface CompassQuery
Parameters:
name - The property name that will be sorted.

addSort

public CompassQuery addSort(String name,
                            CompassQuery.SortDirection direction)
Description copied from interface: CompassQuery
Adds sorting on the given property name. The type of sorting will be identified automatically (though it is preferable to specify it in advance using the CompassQuery.addSort(String,SortPropertyType).

Note that the property must be UN_TOKENIZED, and stored.

Note, that the sort option will only work on the outer most query (i.e. the one that the hits is called on).

Specified by:
addSort in interface CompassQuery
Parameters:
name - The property name that will be sorted.
direction - The direction for the sorting.
Returns:
the query

addSort

public CompassQuery addSort(String name,
                            CompassQuery.SortPropertyType type)
Description copied from interface: CompassQuery
Adds sorting on the given property name, and using the given property type. Note that INT has the lowest memorty requirements and STRING the most.

Note that the property must be UN_TOKENIZED, and stored.

Note, that the sort option will only work on the outer most query (i.e. the one that the hits is called on).

Specified by:
addSort in interface CompassQuery
Parameters:
name - The property name that will be sorted.
type - The type of the propert.
Returns:
the query

addSort

public CompassQuery addSort(String name,
                            CompassQuery.SortPropertyType type,
                            CompassQuery.SortDirection direction)
Description copied from interface: CompassQuery
Adds sorting on the given property name, and using the given property type. Note that INT has the lowest memorty requirements and STRING the most.

Note that the property must be UN_TOKENIZED, and stored.

Note, that the sort option will only work on the outer most query (i.e. the one that the hits is called on).

Specified by:
addSort in interface CompassQuery
Parameters:
name - The property name that will be sorted.
type - The type of the propert.
direction - The direction of the sorting.
Returns:
the query

addSort

public CompassQuery addSort(CompassQuery.SortImplicitType implicitType)
Description copied from interface: CompassQuery
Adds sorting on implicit types, which are not direct properties values.

Note, that the sort option will only work on the outer most query (i.e. the one that the hits is called on).

Specified by:
addSort in interface CompassQuery
Parameters:
implicitType - The implicit type to add sorting on.

addSort

public CompassQuery addSort(CompassQuery.SortImplicitType implicitType,
                            CompassQuery.SortDirection direction)
Description copied from interface: CompassQuery
Adds sorting on implicit types, which are not direct properties values.

Note, that the sort option will only work on the outer most query (i.e. the one that the hits is called on).

Specified by:
addSort in interface CompassQuery
Parameters:
implicitType - The implicit type to add sorting on.
direction - The direction of the sorting.

setSubIndexes

public CompassQuery setSubIndexes(String[] subIndexes)
Description copied from interface: CompassQuery
Narrows down the query to be executed only against the given sub indexes. If set to null, will use all sub indexes.

Specified by:
setSubIndexes in interface CompassQuery
Parameters:
subIndexes - sub indexes the query will be executed against
Returns:
The query

setAliases

public CompassQuery setAliases(String[] aliases)
Description copied from interface: CompassQuery
Narrows down the query to be executed only against the given aliases. If set to null, will use all aliases.

Specified by:
setAliases in interface CompassQuery
Parameters:
aliases - aliases the query will be executed against
Returns:
th query

setTypes

public CompassQuery setTypes(Class[] types)
Description copied from interface: CompassQuery
Narrows down the query to be executed only against the given types. Internally will translate the classes to the relevant root aliases and call CompassQuery.setAliases(String[]).

Specified by:
setTypes in interface CompassQuery
Parameters:
types - class types the query will be executed against
Returns:
the query

setFilter

public CompassQuery setFilter(CompassQueryFilter filter)
Description copied from interface: CompassQuery
Sets a filter to the query. Please see CompassQueryFilterBuilder.

Specified by:
setFilter in interface CompassQuery
Parameters:
filter - The filter for the query
Returns:
the query

getFilter

public CompassQueryFilter getFilter()
Description copied from interface: CompassQuery
Returns the filter set using CompassQuery.setFilter(CompassQueryFilter). null if none is set.

Specified by:
getFilter in interface CompassQuery
Returns:
The filter set using CompassQuery.setFilter(CompassQueryFilter)

hits

public CompassHits hits()
                 throws CompassException
Description copied from interface: CompassQuery
Performs the search and returns the hits that match the qeury.

Specified by:
hits in interface CompassQuery
Throws:
CompassException

getSearchEngineQuery

public SearchEngineQuery getSearchEngineQuery()

toString

public String toString()
Overrides:
toString in class Object


Copyright (c) 2004-2006 The Compass Project.