java.lang.Object
com.github.oeuvres.alix.lucene.search.Scale

public class Scale extends Object
Handle data to display results as a chronology, according to subset of an index, given as a bitset.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A row of data for a crossing axis
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    Count of docs
    final FieldInt
    Field name, type: NumericDocValuesField, for int values
    final FieldText
    Field name, type.
    final Scale.Tick[]
    Data, sorted in docid order, used in term search stats
    final Scale.Tick[]
    Data, sorted in fieldInt order, used to write an axis
  • Constructor Summary

    Constructors
    Constructor
    Description
    Scale(Alix alix, String fieldInt, String fieldText)
    Constructor with alix objects for a lucene reader, an int field, and a text field.
    Scale(Alix alix, String fieldInt, String fieldText, org.apache.lucene.util.BitSet docFilter)
    Constructor with alix objects for a lucene reader, an int field, and a text field.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return data to display an axis for the corpus.
    long[][]
    curves(String[] forms, int dots)
    Ask for a count of forms, according to a number of dot (ex: 100).
    long[][]
    legend(int dots)
    For each dot, his occurrence index, a label like a year, and a doc order.
    long
    Returns the total count of occurrences for this scale.
    int
    max()
    Maximun value of this scale.
    int
    min()
    Minimum value of this scale.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • fint

      public final FieldInt fint
      Field name, type: NumericDocValuesField, for int values
    • ftext

      public final FieldText ftext
      Field name, type. TextField, for text occurrences
    • docs

      public final int docs
      Count of docs
    • tickByOrder

      public final Scale.Tick[] tickByOrder
      Data, sorted in fieldInt order, used to write an axis
    • tickByDocid

      public final Scale.Tick[] tickByDocid
      Data, sorted in docid order, used in term search stats
  • Constructor Details

    • Scale

      public Scale(Alix alix, String fieldInt, String fieldText) throws IOException
      Constructor with alix objects for a lucene reader, an int field, and a text field.
      Parameters:
      alix - wrapper on a lucene reader.
      fieldInt - stats on an int field.
      fieldText - stats on a text field.
      Throws:
      IOException - lucene errors.
    • Scale

      public Scale(Alix alix, String fieldInt, String fieldText, org.apache.lucene.util.BitSet docFilter) throws IOException
      Constructor with alix objects for a lucene reader, an int field, and a text field.
      Parameters:
      alix - wrapper on a lucene reader.
      fieldInt - stats on an int field.
      fieldText - stats on a text field.
      docFilter - if not null, documents to exclude from stats.
      Throws:
      IOException - lucene errors.
  • Method Details

    • min

      public int min()
      Minimum value of this scale.
      Returns:
      minimum value.
    • max

      public int max()
      Maximun value of this scale.
      Returns:
      maximum value.
    • length

      public long length()
      Returns the total count of occurrences for this scale.
      Returns:
      total count of occurrences.
    • axis

      public Scale.Tick[] axis()
      Return data to display an axis for the corpus.
      Returns:
      lists of ticks.
    • legend

      public long[][] legend(int dots)
      For each dot, his occurrence index, a label like a year, and a doc order.
      Parameters:
      dots - How many dots for a curve?
      Returns:
      a complex double array to document more.
    • curves

      public long[][] curves(String[] forms, int dots) throws IOException
      Ask for a count of forms, according to a number of dot (ex: 100). Repartition is equal by occurrences (may be more or less than one year) so as an x value, it is a number of occurrences, not a year, label is given by legend(). #) col[0] global count of occurrences for each requested point #) populate an array docId → pointIndex #) loop on index reader to get count
      Parameters:
      forms - A list of terms to search
      dots - Number of dots by curve.
      Returns:
      a complex array.
      Throws:
      IOException - Lucene errors.