@Override public Fragmenter getFragmenter(String fieldName, SolrParams params ) { numRequests++; params = SolrParams.wrapDefaults(params, defaults); int fragsize = params.getFieldInt( fieldName, HighlightParams.FRAGSIZE, LuceneRegexFragmenter.DEFAULT_FRAGMENT_SIZE ); int increment = params.getFieldInt( fieldName, HighlightParams.INCREMENT, LuceneRegexFragmenter.DEFAULT_INCREMENT_GAP ); float slop = params.getFieldFloat( fieldName, HighlightParams.SLOP, LuceneRegexFragmenter.DEFAULT_SLOP ); int maxchars = params.getFieldInt( fieldName, HighlightParams.MAX_RE_CHARS, LuceneRegexFragmenter.DEFAULT_MAX_ANALYZED_CHARS ); String rawpat = params.getFieldParam( fieldName, HighlightParams.PATTERN, LuceneRegexFragmenter.DEFAULT_PATTERN_RAW ); Pattern p = rawpat == defaultPatternRaw ? defaultPattern : Pattern.compile(rawpat); if( fragsize <= 0 ) { return new NullFragmenter(); } return new LuceneRegexFragmenter( fragsize, increment, slop, maxchars, p ); }
@Override public Fragmenter getFragmenter(String fieldName, SolrParams params ) { numRequests++; params = SolrParams.wrapDefaults(params, defaults); int fragsize = params.getFieldInt( fieldName, HighlightParams.FRAGSIZE, 100 ); return (fragsize <= 0) ? new NullFragmenter() : new LuceneGapFragmenter(fragsize); }