Example usage for org.apache.lucene.search.suggest.analyzing FreeTextSuggester DEFAULT_SEPARATOR

List of usage examples for org.apache.lucene.search.suggest.analyzing FreeTextSuggester DEFAULT_SEPARATOR

Introduction

In this page you can find the example usage for org.apache.lucene.search.suggest.analyzing FreeTextSuggester DEFAULT_SEPARATOR.

Prototype

byte DEFAULT_SEPARATOR

To view the source code for org.apache.lucene.search.suggest.analyzing FreeTextSuggester DEFAULT_SEPARATOR.

Click Source Link

Document

The default character used to join multiple tokens into a single ngram token.

Usage

From source file:org.apache.solr.spelling.suggest.fst.FreeTextLookupFactory.java

License:Apache License

@Override
public Lookup create(NamedList params, SolrCore core) {
    Object fieldTypeName = params.get(QUERY_ANALYZER);
    if (fieldTypeName == null) {
        throw new IllegalArgumentException(
                "Error in configuration: " + QUERY_ANALYZER + " parameter is mandatory");
    }/*  ww w . j  av a 2  s .  c o  m*/
    FieldType ft = core.getLatestSchema().getFieldTypeByName(fieldTypeName.toString());
    if (ft == null) {
        throw new IllegalArgumentException(
                "Error in configuration: " + fieldTypeName.toString() + " is not defined in the schema");
    }

    Analyzer indexAnalyzer = ft.getIndexAnalyzer();
    Analyzer queryAnalyzer = ft.getQueryAnalyzer();

    int grams = (params.get(NGRAMS) != null) ? Integer.parseInt(params.get(NGRAMS).toString())
            : FreeTextSuggester.DEFAULT_GRAMS;

    byte separator = (params.get(SEPARATOR) != null)
            ? params.get(SEPARATOR).toString().getBytes(StandardCharsets.UTF_8)[0]
            : FreeTextSuggester.DEFAULT_SEPARATOR;

    return new FreeTextSuggester(indexAnalyzer, queryAnalyzer, grams, separator);
}