Package play.modules.elasticsearch.annotations.analysis

Examples of play.modules.elasticsearch.annotations.analysis.ElasticSearchAnalysis


  public void addSettings(XContentBuilder builder) throws IOException{

    if(clazz.getAnnotation(ElasticSearchable.class).analysis() == null)
      return;

    ElasticSearchAnalysis analysis = clazz.getAnnotation(ElasticSearchable.class).analysis();
   
    if((analysis.analyzers() == null || analysis.analyzers().length < 1) &&
       (analysis.filters() == null || analysis.filters().length < 1))
      return;
   
    builder.startObject("analysis");
   
    if(analysis.analyzers() != null && analysis.analyzers().length > 0){
      builder.startObject("analyzer");

      for (ElasticSearchAnalyzer analyzer : analysis.analyzers()) {
       
        builder.startObject(analyzer.name());
       
        if(analyzer.tokenizer() != null)
          builder.field("tokenizer", analyzer.tokenizer());
       
        if(analyzer.filtersNames() != null && analyzer.filtersNames().length > 0)
          builder.field("filter", analyzer.filtersNames());
       
        builder.endObject();
      }
     
      builder.endObject();
    }
   
    if(analysis.filters() != null && analysis.filters().length > 0){
     
      builder.startObject("filter");
   
      for (ElasticSearchFilter filter : analysis.filters()) {
       
        builder.startObject(filter.name());
       
        builder.field("type", filter.typeName());
       
View Full Code Here

TOP

Related Classes of play.modules.elasticsearch.annotations.analysis.ElasticSearchAnalysis

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.