Package org.elasticsearch.search.highlight

Examples of org.elasticsearch.search.highlight.HighlightBuilder$Field


    @Test
    public void record_error_for_field()
    {
        ValidationTracker tracker = mockValidationTracker();
        String message = "A recorded message.";
        Field field = mockField();

        tracker.recordError(field, message);

        replay();
View Full Code Here


  }
 
  void onValidateFromGenericField(String value) {
    if (value == null || !value.toLowerCase().startsWith("a")) {
      String fieldName = getFieldName(genericField.getControlName());
      Field fieldSnapshot = new FieldSnapshot(genericField);
      form.recordError(fieldSnapshot, fieldName + " must start with 'a'");
    }
  }
View Full Code Here

public class FieldTranslatorSourceImplTest extends InternalBaseTestCase
{
    @Test
    public void create_default_property_type_null()
    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;

        replay();
View Full Code Here

      int hlsnippets = request.paramAsInt("hl.snippets", 1);
      int hlfragsize = request.paramAsInt("hl.fragsize", 100);
      String hlsimplepre = request.param("hl.simple.pre");
      String hlsimplepost = request.param("hl.simple.post");

      HighlightBuilder highlightBuilder = new HighlightBuilder();
      if (hlfl == null) {
        // run against default _all field
        highlightBuilder.field("_all", hlfragsize, hlsnippets);
      } else {
        String[] hlfls = hlfl.split("\\s|,");
        for (String hlField : hlfls) {
          // skip wildcarded fields
          if (!hlField.contains("*")) {
            highlightBuilder.field(hlField, hlfragsize, hlsnippets);
          }
        }
      }

      // pre tags
      if (hlsimplepre != null) {
        highlightBuilder.preTags(hlsimplepre);
      }

      // post tags
      if (hlsimplepost != null) {
        highlightBuilder.postTags(hlsimplepost);
      }

      searchSourceBuilder.highlight(highlightBuilder);

    }
View Full Code Here

    /**
     * A static factory method to construct new search highlights.
     */
    public static HighlightBuilder highlight() {
        return new HighlightBuilder();
    }
View Full Code Here

        return this;
    }

    public HighlightBuilder highlighter() {
        if (highlightBuilder == null) {
            highlightBuilder = new HighlightBuilder();
        }
        return highlightBuilder;
    }
View Full Code Here

        searchSourceBuilder.facet(facetBuilder);
    }

    private void addHighlights(SearchSourceBuilder searchSourceBuilder) {
        HighlightBuilder highlightBuilder =
                new HighlightBuilder().order("score").requireFieldMatch(false).field("rawContent", 300, 1);

        searchSourceBuilder.highlight(highlightBuilder);
    }
View Full Code Here

      int hlsnippets = request.paramAsInt("hl.snippets", 1);
      int hlfragsize = request.paramAsInt("hl.fragsize", 100);
      String hlsimplepre = request.param("hl.simple.pre");
      String hlsimplepost = request.param("hl.simple.post");

      HighlightBuilder highlightBuilder = new HighlightBuilder();
      if (hlfl == null) {
        // run against default _all field
        highlightBuilder.field("_all", hlfragsize, hlsnippets);
      } else {
        String[] hlfls = hlfl.split("\\s|,");
        for (String hlField : hlfls) {
          // skip wildcarded fields
          if (!hlField.contains("*")) {
            highlightBuilder.field(hlField, hlfragsize, hlsnippets);
          }
        }
      }

      // pre tags
      if (hlsimplepre != null) {
        highlightBuilder.preTags(hlsimplepre);
      }

      // post tags
      if (hlsimplepost != null) {
        highlightBuilder.postTags(hlsimplepost);
      }

      searchSourceBuilder.highlight(highlightBuilder);

    }
View Full Code Here

    /**
     * A static factory method to construct new search highlights.
     */
    public static HighlightBuilder highlight() {
        return new HighlightBuilder();
    }
View Full Code Here

        }
    }

    public HighlightBuilder highlighter() {
        if (highlightBuilder == null) {
            highlightBuilder = new HighlightBuilder();
        }
        return highlightBuilder;
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.search.highlight.HighlightBuilder$Field

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.