Java 类org.apache.lucene.search.postingshighlight.PassageScorer 实例源码

项目:search    文件:PostingsSolrHighlighter.java   
@Override
protected PassageScorer getScorer(String fieldName) {
  float k1 = params.getFieldFloat(fieldName, HighlightParams.SCORE_K1, 1.2f);
  float b = params.getFieldFloat(fieldName, HighlightParams.SCORE_B, 0.75f);
  float pivot = params.getFieldFloat(fieldName, HighlightParams.SCORE_PIVOT, 87f);
  return new PassageScorer(k1, b, pivot);
}
项目:ifpress-solr-plugin    文件:SafariSolrHighlighter.java   
@Override
protected PassageScorer getScorer(String fieldName) {
  float k1 = params.getFieldFloat(fieldName, HighlightParams.SCORE_K1, 1.2f);
  float b = params.getFieldFloat(fieldName, HighlightParams.SCORE_B, 0.75f);
  float pivot = params.getFieldFloat(fieldName, HighlightParams.SCORE_PIVOT, 87f);
  return new PassageScorer(k1, b, pivot);
}
项目:NYBC    文件:PostingsSolrHighlighter.java   
@Override
public void init(PluginInfo info) {
  Map<String,String> attributes = info.attributes;
  BreakIterator breakIterator = BreakIterator.getSentenceInstance(Locale.ROOT);
  PassageScorer scorer = new PassageScorer();

  // formatter parameters: preTag/postTag/ellipsis
  String preTag = attributes.get("preTag");
  if (preTag == null) {
    preTag = "<em>";
  }
  String postTag = attributes.get("postTag");
  if (postTag == null) {
    postTag = "</em>";
  }
  String ellipsis = attributes.get("ellipsis");
  if (ellipsis == null) {
    ellipsis = "... ";
  }
  PassageFormatter formatter = new PassageFormatter(preTag, postTag, ellipsis);

  // maximum content size to process
  int maxLength = PostingsHighlighter.DEFAULT_MAX_LENGTH;
  if (attributes.containsKey("maxLength")) {
    maxLength = Integer.parseInt(attributes.get("maxLength"));
  }
  highlighter = new PostingsHighlighter(maxLength, breakIterator, scorer, formatter);
}
项目:search-core    文件:PostingsSolrHighlighter.java   
@Override
public void init(PluginInfo info) {
  Map<String,String> attributes = info.attributes;
  BreakIterator breakIterator = BreakIterator.getSentenceInstance(Locale.ROOT);
  PassageScorer scorer = new PassageScorer();

  // formatter parameters: preTag/postTag/ellipsis
  String preTag = attributes.get("preTag");
  if (preTag == null) {
    preTag = "<em>";
  }
  String postTag = attributes.get("postTag");
  if (postTag == null) {
    postTag = "</em>";
  }
  String ellipsis = attributes.get("ellipsis");
  if (ellipsis == null) {
    ellipsis = "... ";
  }
  PassageFormatter formatter = new PassageFormatter(preTag, postTag, ellipsis);

  // maximum content size to process
  int maxLength = PostingsHighlighter.DEFAULT_MAX_LENGTH;
  if (attributes.containsKey("maxLength")) {
    maxLength = Integer.parseInt(attributes.get("maxLength"));
  }
  highlighter = new PostingsHighlighter(maxLength, breakIterator, scorer, formatter);
}
项目:read-open-source-code    文件:PostingsSolrHighlighter.java   
@Override
protected PassageScorer getScorer(String fieldName) {
  float k1 = params.getFieldFloat(fieldName, HighlightParams.SCORE_K1, 1.2f);
  float b = params.getFieldFloat(fieldName, HighlightParams.SCORE_B, 0.75f);
  float pivot = params.getFieldFloat(fieldName, HighlightParams.SCORE_PIVOT, 87f);
  return new PassageScorer(k1, b, pivot);
}