lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r785218 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
Date Tue, 16 Jun 2009 13:53:25 GMT
Author: markrmiller
Date: Tue Jun 16 13:53:25 2009
New Revision: 785218

URL: http://svn.apache.org/viewvc?rev=785218&view=rev
Log:
SOLR-1150: Load Documents for Highlighting one at a time rather than all at once to avoid
OOM with many large Documents. 

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=785218&r1=785217&r2=785218&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Tue Jun 16 13:53:25 2009
@@ -287,6 +287,9 @@
 
 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)

Modified: lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java?rev=785218&r1=785217&r2=785218&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java Tue Jun
16 13:53:25 2009
@@ -244,16 +244,15 @@
      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 @@
     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 @@
                     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;
                     }



Mime
View raw message