mirror of
https://github.com/apache/lucene.git
synced 2025-02-27 13:06:37 +00:00
LUCENE-4608: Handle large number of requested fragments better.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1421872 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
750e0ef311
commit
96926cf07d
@ -288,6 +288,9 @@ Bug Fixes
|
||||
indexed and the Iterator throws an exception. Documents were only rolled back
|
||||
if the actual indexing process failed. (Simon Willnauer)
|
||||
|
||||
* LUCENE-4608: Handle large number of requested fragments better.
|
||||
(Martijn van Groningen)
|
||||
|
||||
Changes in Runtime Behavior
|
||||
|
||||
* LUCENE-4586: Change default ResultMode of FacetRequest to PER_NODE_IN_TREE.
|
||||
|
@ -124,7 +124,6 @@ public abstract class BaseFragmentsBuilder implements FragmentsBuilder {
|
||||
}
|
||||
|
||||
List<WeightedFragInfo> fragInfos = fieldFragList.getFragInfos();
|
||||
List<String> fragments = new ArrayList<String>( maxNumFragments );
|
||||
Field[] values = getFields( reader, docId, fieldName );
|
||||
if( values.length == 0 ) {
|
||||
return null;
|
||||
@ -135,9 +134,12 @@ public abstract class BaseFragmentsBuilder implements FragmentsBuilder {
|
||||
}
|
||||
|
||||
fragInfos = getWeightedFragInfoList(fragInfos);
|
||||
int limitFragments = maxNumFragments < fragInfos.size() ? maxNumFragments : fragInfos.size();
|
||||
List<String> fragments = new ArrayList<String>( limitFragments );
|
||||
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
int[] nextValueIndex = { 0 };
|
||||
for( int n = 0; n < maxNumFragments && n < fragInfos.size(); n++ ){
|
||||
for( int n = 0; n < limitFragments; n++ ){
|
||||
WeightedFragInfo fragInfo = fragInfos.get( n );
|
||||
fragments.add( makeFragment( buffer, nextValueIndex, values, fragInfo, preTags, postTags, encoder ) );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user