Esri Geoportal Server
1.0

com.esri.gpt.catalog.lucene.stats
Class SingleFieldStats

java.lang.Object
  extended by com.esri.gpt.catalog.lucene.stats.SingleFieldStats

public class SingleFieldStats
extends Object

Provides statistics associated with a single field.

Statistics are unavailable until collected.

Statistics provided are:


Constructor Summary
SingleFieldStats(String fieldName)
          Construct with a supplied field name.
SingleFieldStats(String fieldName, int maxRecords, int minFrequency, int maxFrequency)
          Constructs with a supplied field name and min/max thresholds.
 
Method Summary
 void collectStats(StatsRequest request, IndexReader reader)
          Executes the collection of statistics.
protected  long determineNumberOfDocsConsidered(IndexReader reader, OpenBitSet documentFilterBitSet)
          Determines the number of documents considered during stats collection.
 long getNumberOfDocsConsidered()
          Gets the number of documents considered during stats collection.
protected  boolean getSortByFrequency()
          Gets the flag indicating whether or not results should be sorted by frequency.
 long getTimeMillis()
          Gets the execution time.
protected  void setNumberOfDocsConsidered(long count)
          Sets the number of documents considered during stats collection.
protected  void setTimeMillis(long millis)
          Sets the execution time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleFieldStats

public SingleFieldStats(String fieldName)
Construct with a supplied field name.

Parameters:
fieldName - the field name

SingleFieldStats

public SingleFieldStats(String fieldName,
                        int maxRecords,
                        int minFrequency,
                        int maxFrequency)
Constructs with a supplied field name and min/max thresholds.

Parameters:
fieldName - the field name
maxRecords - the maximum number of records to return
minFrequency - the minimum term frequency to consider
maxFrequency - the maximum term frequency to consider
Method Detail

collectStats

public void collectStats(StatsRequest request,
                         IndexReader reader)
                  throws IOException
Executes the collection of statistics.

Parameters:
request - the active statistics request
reader - the index reader
Throws:
IOException - if an error occurs while communicating with the index

getNumberOfDocsConsidered

public long getNumberOfDocsConsidered()
Gets the number of documents considered during stats collection.

Returns:
the number of documents considered

setNumberOfDocsConsidered

protected void setNumberOfDocsConsidered(long count)
Sets the number of documents considered during stats collection.

Parameters:
count - the number of documents considered

getSortByFrequency

protected boolean getSortByFrequency()
Gets the flag indicating whether or not results should be sorted by frequency.

Returns:
true if results should be sorted by frequency

getTimeMillis

public long getTimeMillis()
Gets the execution time.

Returns:
the execution time (in milliseconds)

setTimeMillis

protected void setTimeMillis(long millis)
Sets the execution time.

Parameters:
millis - the execution time (in milliseconds)

determineNumberOfDocsConsidered

protected long determineNumberOfDocsConsidered(IndexReader reader,
                                               OpenBitSet documentFilterBitSet)
Determines the number of documents considered during stats collection.
If the document filter bitset is not null, the count will be based upon it's cardinality.
Otherwise the count will be based upon the number of docs returned by the reader.

Parameters:
reader - the index reader
documentFilterBitSet - the bitset represing the subset of documents being cosidered
Returns:
the total number of documents

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.