org.compass.core
Interface CompassTermFreqsBuilder

All Known Implementing Classes:
DefaultCompassTermFreqsBuilder

public interface CompassTermFreqsBuilder

A term and frequencies builder, allows to set different settings regaring the avilable terms for certain properties and their respective frequencies.

Allows to narrow down the sub indexes searched either by setting the aliases or the sub indexes (or both of them).

Allows to set how the returned terns will be sort. Either by the TERM value or the TERM frequency. Note, the (adjustable) size of terms will always be based on the ones with the highest frequency. Within this size based list (controlled using setSize(int)), the sorting will occur.

By default, the frequency will be returned according to the search engine implementation values (in Lucene, it is the doc freq). The builder allows to normalize this values. For example, to values between 0 and 1, 0 and 100, or any other range.

Author:
kimchy

Nested Class Summary
static class CompassTermFreqsBuilder.Sort
           
 
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.
 

Method Detail

setSize

CompassTermFreqsBuilder setSize(int size)
Sets the size of the results that will be returned. The size will always contain the highest frequencies. Defaults to 10.


setAliases

CompassTermFreqsBuilder setAliases(String... aliases)
Narrow down the terms to specific aliases (which in trun automatically map to a sub index).


setTypes

CompassTermFreqsBuilder setTypes(Class... types)
Narrow down teh terms to specific classes (which map to aliases).


setSubIndexes

CompassTermFreqsBuilder setSubIndexes(String... subIndexes)
Narrow down the terms to specific sub indexes.


setSort

CompassTermFreqsBuilder setSort(CompassTermFreqsBuilder.Sort sort)
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 setSize(int) setting.


normalize

CompassTermFreqsBuilder normalize(int min,
                                  int max)
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.


toTermFreqs

CompassTermFreq[] toTermFreqs()
                              throws CompassException
Builds and returns the term and their frequencies.

Throws:
CompassException


Copyright (c) 2004-2008 The Compass Project.