org.hibernate.search.util

## Class AnalyzerUtils

- java.lang.Object
- - org.hibernate.search.util.AnalyzerUtils

-     public final class AnalyzerUtils
      extends Object

  Helper class to hide boilerplate code when using Lucene Analyzers.

  Taken and modified from Lucene in Action.

  Author:
    Hardy Ferentschik

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Log` | `log`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `displayTokens(Analyzer analyzer, String field, String text)`
    `static void` | `displayTokensWithFullDetails(Analyzer analyzer, String field, String text)`
    `static void` | `displayTokensWithPositions(Analyzer analyzer, String field, String text, PrintStream printTo)` Utility to print out the tokens generated by a specific Analyzer on an example text.
    `static String` | `getTermText(Token token)`
    `static List<String>` | `tokenizedTermValues(Analyzer analyzer, String field, String text)`
    `static Token[]` | `tokensFromAnalysis(Analyzer analyzer, String field, String text)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### log

          public static final Log log

  - ### Method Detail

    - #### tokenizedTermValues

          public static List<String> tokenizedTermValues(Analyzer analyzer,
                                                         String field,
                                                         String text)
                                                  throws IOException

      Throws:
        `IOException`

    - #### tokensFromAnalysis

          public static Token[] tokensFromAnalysis(Analyzer analyzer,
                                                   String field,
                                                   String text)
                                            throws IOException

      Throws:
        `IOException`

    - #### displayTokens

          public static void displayTokens(Analyzer analyzer,
                                           String field,
                                           String text)
                                    throws IOException

      Throws:
        `IOException`

    - #### displayTokensWithPositions

          public static void displayTokensWithPositions(Analyzer analyzer,
                                                        String field,
                                                        String text,
                                                        PrintStream printTo)
                                                 throws IOException

      Utility to print out the tokens generated by a specific Analyzer on an example text. You have to specify the field name as well, as some Analyzer(s) might have a different configuration for each field. This implementation is not suited for top performance and is not used by Hibernate Search during automatic indexing: this method is only made available to help understanding and debugging the analyzer chain.
      Parameters:
        `analyzer` - the Analyzer to use
        `field` - the name of the field: might affect the Analyzer behaviour
        `text` - some sample input
        `printTo` - Human readable text will be printed to this output. Passing `System.out` might be a good idea.
      Throws:
        `IOException` - if an I/O error occurs

    - #### displayTokensWithFullDetails

          public static void displayTokensWithFullDetails(Analyzer analyzer,
                                                          String field,
                                                          String text)
                                                   throws IOException

      Throws:
        `IOException`

    - #### getTermText

          public static String getTermText(Token token)

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved