• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BoundaryScanner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getBoundaryScanner

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
private static BoundaryScanner getBoundaryScanner(Field field) {
    final FieldOptions fieldOptions = field.fieldOptions();
    final Locale boundaryScannerLocale = fieldOptions.boundaryScannerLocale();
    switch(fieldOptions.boundaryScannerType()) {
    case SENTENCE:
        if (boundaryScannerLocale != null) {
            return new BreakIteratorBoundaryScanner(BreakIterator.getSentenceInstance(boundaryScannerLocale));
        }
        return DEFAULT_SENTENCE_BOUNDARY_SCANNER;
    case WORD:
        if (boundaryScannerLocale != null) {
            return new BreakIteratorBoundaryScanner(BreakIterator.getWordInstance(boundaryScannerLocale));
        }
        return DEFAULT_WORD_BOUNDARY_SCANNER;
    default:
        if (fieldOptions.boundaryMaxScan() != SimpleBoundaryScanner.DEFAULT_MAX_SCAN
                || fieldOptions.boundaryChars() != SimpleBoundaryScanner.DEFAULT_BOUNDARY_CHARS) {
            return new SimpleBoundaryScanner(fieldOptions.boundaryMaxScan(), fieldOptions.boundaryChars());
        }
        return DEFAULT_SIMPLE_BOUNDARY_SCANNER;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:FastVectorHighlighter.java


示例2: SourceScoreOrderFragmentsBuilder

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
public SourceScoreOrderFragmentsBuilder(FieldMapper mapper, SearchContext searchContext,
                                        FetchSubPhase.HitContext hitContext, String[] preTags, String[] postTags, BoundaryScanner boundaryScanner) {
    super(preTags, postTags, boundaryScanner);
    this.mapper = mapper;
    this.searchContext = searchContext;
    this.hitContext = hitContext;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:SourceScoreOrderFragmentsBuilder.java


示例3: get

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
@Override
protected BoundaryScanner get(String fieldName, SolrParams params) {
  // construct Locale
  String language = params.getFieldParam(fieldName, HighlightParams.BS_LANGUAGE);
  String country = params.getFieldParam(fieldName, HighlightParams.BS_COUNTRY);
  if(country != null && language == null){
    throw new SolrException(ErrorCode.BAD_REQUEST,
        HighlightParams.BS_LANGUAGE + " parameter cannot be null when you specify " + HighlightParams.BS_COUNTRY);
  }
  Locale locale = null;
  if(language != null){
    locale = country == null ? new Locale(language) : new Locale(language, country);
  } else {
    locale = Locale.ROOT;
  }

  // construct BreakIterator
  String type = params.getFieldParam(fieldName, HighlightParams.BS_TYPE, "WORD").toLowerCase(Locale.ROOT);
  BreakIterator bi = null;
  if(type.equals("character")){
    bi = BreakIterator.getCharacterInstance(locale);
  }
  else if(type.equals("word")){
    bi = BreakIterator.getWordInstance(locale);
  }
  else if(type.equals("line")){
    bi = BreakIterator.getLineInstance(locale);
  }
  else if(type.equals("sentence")){
    bi = BreakIterator.getSentenceInstance(locale);
  }
  else
    throw new SolrException(ErrorCode.BAD_REQUEST, type + " is invalid for parameter " + HighlightParams.BS_TYPE);

  return new org.apache.lucene.search.vectorhighlight.BreakIteratorBoundaryScanner(bi);
}
 
开发者ID:europeana,项目名称:search,代码行数:37,代码来源:BreakIteratorBoundaryScanner.java


示例4: getFragmentsBuilder

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
/**
 * Return a {@link org.apache.lucene.search.vectorhighlight.FragmentsBuilder} appropriate for this field.
 * 
 * @param params The params controlling Highlighting
 * @return An appropriate {@link org.apache.lucene.search.vectorhighlight.FragmentsBuilder}.
 */
public FragmentsBuilder getFragmentsBuilder(SolrParams params, BoundaryScanner bs) {
  numRequests++;
  params = SolrParams.wrapDefaults(params, defaults);

  return getFragmentsBuilder( params, getPreTags( params, null ), getPostTags( params, null ), bs );
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:SolrFragmentsBuilder.java


示例5: getFragmentsBuilder

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
@Override
protected FragmentsBuilder getFragmentsBuilder( SolrParams params,
    String[] preTags, String[] postTags, BoundaryScanner bs ) {
  org.apache.lucene.search.vectorhighlight.SimpleFragmentsBuilder sfb =
    new org.apache.lucene.search.vectorhighlight.SimpleFragmentsBuilder( preTags, postTags, bs );
  sfb.setMultiValuedSeparator( getMultiValuedSeparatorChar( params ) );
  return sfb;
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:SimpleFragmentsBuilder.java


示例6: getFragmentsBuilder

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
@Override
protected FragmentsBuilder getFragmentsBuilder( SolrParams params,
    String[] preTags, String[] postTags, BoundaryScanner bs ) {
  org.apache.lucene.search.vectorhighlight.ScoreOrderFragmentsBuilder sofb =
    new org.apache.lucene.search.vectorhighlight.ScoreOrderFragmentsBuilder( preTags, postTags, bs );
  sofb.setMultiValuedSeparator( getMultiValuedSeparatorChar( params ) );
  return sofb;
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:ScoreOrderFragmentsBuilder.java


示例7: get

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
@Override
protected BoundaryScanner get(String fieldName, SolrParams params) {
  int maxScan = params.getFieldInt(fieldName, HighlightParams.BS_MAX_SCAN, 10);
  String str = params.getFieldParam(fieldName, HighlightParams.BS_CHARS, ".,!? \t\n");
  Character[] chars = new Character[str.length()];
  for(int i = 0; i < str.length(); i++){
    chars[i] = str.charAt(i);
  }
  return new org.apache.lucene.search.vectorhighlight.SimpleBoundaryScanner(maxScan, chars);
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:SimpleBoundaryScanner.java


示例8: getBoundaryScanner

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
private BoundaryScanner getBoundaryScanner(String fieldName, SolrParams params)
{
    String bs = params.getFieldParam(fieldName, HighlightParams.BOUNDARY_SCANNER);
    SolrBoundaryScanner solrBs = boundaryScanners.get(bs);
    if (solrBs == null)
    {
        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown boundaryScanner: " + bs);
    }
    return solrBs.getBoundaryScanner(fieldName, params);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:11,代码来源:AlfrescoSolrHighlighter.java


示例9: SourceScoreOrderFragmentsBuilder

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
public SourceScoreOrderFragmentsBuilder(FieldMapper mapper, SearchContext searchContext, String[] preTags, String[] postTags,
                                        BoundaryScanner boundaryScanner) {
    super(preTags, postTags, boundaryScanner);
    this.mapper = mapper;
    this.searchContext = searchContext;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:SourceScoreOrderFragmentsBuilder.java


示例10: SimpleFragmentsBuilder

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
public SimpleFragmentsBuilder(FieldMapper mapper,
                                    String[] preTags, String[] postTags, BoundaryScanner boundaryScanner) {
    super(preTags, postTags, boundaryScanner);
    this.mapper = mapper;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:SimpleFragmentsBuilder.java


示例11: SourceSimpleFragmentsBuilder

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
public SourceSimpleFragmentsBuilder(FieldMapper mapper, SearchContext searchContext, String[] preTags, String[] postTags,
                                    BoundaryScanner boundaryScanner) {
    super(mapper, preTags, postTags, boundaryScanner);
    this.searchContext = searchContext;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:SourceSimpleFragmentsBuilder.java


示例12: SourceSimpleFragmentsBuilder

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
public SourceSimpleFragmentsBuilder(FieldMapper mapper, SearchContext searchContext,
                                    FetchSubPhase.HitContext hitContext, String[] preTags, String[] postTags, BoundaryScanner boundaryScanner) {
    super(mapper, preTags, postTags, boundaryScanner);
    this.searchContext = searchContext;
    this.hitContext = hitContext;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:SourceSimpleFragmentsBuilder.java


示例13: getBoundaryScanner

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
public BoundaryScanner getBoundaryScanner(String fieldName, SolrParams params){
  numRequests++;
  params = SolrParams.wrapDefaults(params, defaults);

  return get(fieldName, params);
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:SolrBoundaryScanner.java


示例14: getFragmentsBuilder

import org.apache.lucene.search.vectorhighlight.BoundaryScanner; //导入依赖的package包/类
protected FragmentsBuilder getFragmentsBuilder(String fieldName, SolrParams params)
{
    BoundaryScanner bs = getBoundaryScanner(fieldName, params);
    return getSolrFragmentsBuilder(fieldName, params).getFragmentsBuilder(params, bs);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:6,代码来源:AlfrescoSolrHighlighter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FakeRequest类代码示例发布时间:2022-05-23
下一篇:
Java TermFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap