mirror of https://github.com/apache/lucene.git
SOLR-1150: Load Documents for Highlighting one at a time rather than all at once to avoid OOM with many large Documents.
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@785218 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e2ba252765
commit
c0f6146779
|
@ -287,6 +287,9 @@ Optimizations
|
|||
|
||||
14. SOLR-1188: Minor efficiency improvement in TermVectorComponent related to ignoring positions or offsets (gsingers)
|
||||
|
||||
15. SOLR-1150: Load Documents for Highlighting one at a time rather than
|
||||
all at once to avoid OOM with many large Documents. (Siddharth Gargate via Mark Miller)
|
||||
|
||||
Bug Fixes
|
||||
----------------------
|
||||
1. SOLR-774: Fixed logging level display (Sean Timm via Otis Gospodnetic)
|
||||
|
|
|
@ -244,16 +244,15 @@ public class DefaultSolrHighlighter extends SolrHighlighter
|
|||
IndexSchema schema = searcher.getSchema();
|
||||
NamedList fragments = new SimpleOrderedMap();
|
||||
String[] fieldNames = getHighlightFields(query, req, defaultFields);
|
||||
Document[] readDocs = new Document[docs.size()];
|
||||
Set<String> fset = new HashSet<String>();
|
||||
|
||||
{
|
||||
// pre-fetch documents using the Searcher's doc cache
|
||||
Set<String> fset = new HashSet<String>();
|
||||
for(String f : fieldNames) { fset.add(f); }
|
||||
// fetch unique key if one exists.
|
||||
SchemaField keyField = schema.getUniqueKeyField();
|
||||
if(null != keyField)
|
||||
fset.add(keyField.getName());
|
||||
searcher.readDocs(readDocs, docs, fset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -261,7 +260,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter
|
|||
DocIterator iterator = docs.iterator();
|
||||
for (int i = 0; i < docs.size(); i++) {
|
||||
int docId = iterator.nextDoc();
|
||||
Document doc = readDocs[i];
|
||||
Document doc = searcher.doc(docId, fset);
|
||||
NamedList docSummaries = new SimpleOrderedMap();
|
||||
for (String fieldName : fieldNames) {
|
||||
fieldName = fieldName.trim();
|
||||
|
@ -360,7 +359,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter
|
|||
int len = 0;
|
||||
for( String altText: altTexts ){
|
||||
altList.add( len + altText.length() > alternateFieldLen ?
|
||||
altText.substring( 0, alternateFieldLen - len ) : altText );
|
||||
new String(altText.substring( 0, alternateFieldLen - len )) : altText );
|
||||
len += altText.length();
|
||||
if( len >= alternateFieldLen ) break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue