当前位置: 首页>>代码示例>>Java>>正文


Java PassageFormatter类代码示例

本文整理汇总了Java中org.apache.lucene.search.postingshighlight.PassageFormatter的典型用法代码示例。如果您正苦于以下问题:Java PassageFormatter类的具体用法?Java PassageFormatter怎么用?Java PassageFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PassageFormatter类属于org.apache.lucene.search.postingshighlight包,在下文中一共展示了PassageFormatter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFormatter

import org.apache.lucene.search.postingshighlight.PassageFormatter; //导入依赖的package包/类
@Override
protected PassageFormatter getFormatter(String fieldName) {
  String preTag = params.getFieldParam(fieldName, HighlightParams.TAG_PRE, "<em>");
  String postTag = params.getFieldParam(fieldName, HighlightParams.TAG_POST, "</em>");
  String ellipsis = params.getFieldParam(fieldName, HighlightParams.TAG_ELLIPSIS, "... ");
  String encoder = params.getFieldParam(fieldName, HighlightParams.ENCODER, "simple");
  return new DefaultPassageFormatter(preTag, postTag, ellipsis, "html".equals(encoder));
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:PostingsSolrHighlighter.java

示例2: getFormatter

import org.apache.lucene.search.postingshighlight.PassageFormatter; //导入依赖的package包/类
@Override
protected PassageFormatter getFormatter(String fieldName) {
  String preTag = params.getFieldParam(fieldName, HighlightParams.TAG_PRE, "<em>");
  String postTag = params.getFieldParam(fieldName, HighlightParams.TAG_POST, "</em>");
  String ellipsis = params.getFieldParam(fieldName, HighlightParams.TAG_ELLIPSIS, "... ");
  String encoder = params.getFieldParam(fieldName, HighlightParams.ENCODER, "simple");
  return new HighlightFormatter(preTag, postTag, ellipsis, "html".equals(encoder));
}
 
开发者ID:safarijv,项目名称:ifpress-solr-plugin,代码行数:9,代码来源:SafariSolrHighlighter.java

示例3: init

import org.apache.lucene.search.postingshighlight.PassageFormatter; //导入依赖的package包/类
@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);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:29,代码来源:PostingsSolrHighlighter.java


注:本文中的org.apache.lucene.search.postingshighlight.PassageFormatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。