org.compass.core.impl
Class DefaultCompassTermFreqsBuilder

java.lang.Object
  extended by org.compass.core.impl.DefaultCompassTermFreqsBuilder
All Implemented Interfaces:
CompassTermFreqsBuilder

public class DefaultCompassTermFreqsBuilder
extends Object
implements CompassTermFreqsBuilder

Author:
kimchy

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.compass.core.CompassTermFreqsBuilder
CompassTermFreqsBuilder.Sort
 
Constructor Summary
DefaultCompassTermFreqsBuilder(InternalCompassSession session, String[] names)
           
 
Method Summary
 CompassTermFreqsBuilder normalize(int min, int max)
          Normalizes the result frequencies based on the provided min and max values.
 CompassTermFreqsBuilder setAliases(String... aliases)
          Narrow down the terms to specific aliases (which in trun automatically map to a sub index).
 CompassTermFreqsBuilder setSize(int size)
          Sets the size of the results that will be returned.
 CompassTermFreqsBuilder setSort(CompassTermFreqsBuilder.Sort sort)
          Sets the sorting direction of the size based results terms.
 CompassTermFreqsBuilder setSubIndexes(String... subIndexes)
          Narrow down the terms to specific sub indexes.
 CompassTermFreqsBuilder setTypes(Class... types)
          Narrow down teh terms to specific classes (which map to aliases).
 CompassTermFreq[] toTermFreqs()
          Builds and returns the term and their frequencies.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCompassTermFreqsBuilder

public DefaultCompassTermFreqsBuilder(InternalCompassSession session,
                                      String[] names)
Method Detail

setSize

public CompassTermFreqsBuilder setSize(int size)
Description copied from interface: CompassTermFreqsBuilder
Sets the size of the results that will be returned. The size will always contain the highest frequencies. Defaults to 10.

Specified by:
setSize in interface CompassTermFreqsBuilder

setAliases

public CompassTermFreqsBuilder setAliases(String... aliases)
Description copied from interface: CompassTermFreqsBuilder
Narrow down the terms to specific aliases (which in trun automatically map to a sub index).

Specified by:
setAliases in interface CompassTermFreqsBuilder

setTypes

public CompassTermFreqsBuilder setTypes(Class... types)
Description copied from interface: CompassTermFreqsBuilder
Narrow down teh terms to specific classes (which map to aliases).

Specified by:
setTypes in interface CompassTermFreqsBuilder

setSubIndexes

public CompassTermFreqsBuilder setSubIndexes(String... subIndexes)
Description copied from interface: CompassTermFreqsBuilder
Narrow down the terms to specific sub indexes.

Specified by:
setSubIndexes in interface CompassTermFreqsBuilder

normalize

public CompassTermFreqsBuilder normalize(int min,
                                         int max)
Description copied from interface: CompassTermFreqsBuilder
Normalizes the result frequencies based on the provided min and max values. For example, will normalize using 0 to 1 with the lowest frequency mapped to 0, the highest frequency mapped to 1, and the rest are distributed within.

Specified by:
normalize in interface CompassTermFreqsBuilder

setSort

public CompassTermFreqsBuilder setSort(CompassTermFreqsBuilder.Sort sort)
Description copied from interface: CompassTermFreqsBuilder
Sets the sorting direction of the size based results terms. Note, this is the sorting that will be perfomed on the terms of the highest frequencies based on the CompassTermFreqsBuilder.setSize(int) setting.

Specified by:
setSort in interface CompassTermFreqsBuilder

toTermFreqs

public CompassTermFreq[] toTermFreqs()
Description copied from interface: CompassTermFreqsBuilder
Builds and returns the term and their frequencies.

Specified by:
toTermFreqs in interface CompassTermFreqsBuilder


Copyright (c) 2004-2008 The Compass Project.