Hi!

Could you please read the following discussion in java-user mail list
- http://www.gossamer-threads.com/lists/lucene/java-user/35352

You can reproduce OutOfMemory easily. I've attach test files - this is
altered DistanceSortingTest example from LIA book. Also you can
profile it and see caching of distances arrays.

Probably, you could add some caching option to custom sorting feature.

I've modify FieldSortedHitQueue.java to not cache CUSTOM sorting as
"works for me" solution.

-Aleksey

===== FieldSortedHitQueue.java patch =====
@@ -182,7 +182,9 @@
  throws IOException {
    if (type == SortField.DOC) return ScoreDocComparator.INDEXORDER;
    if (type == SortField.SCORE) return ScoreDocComparator.RELEVANCE;
-    ScoreDocComparator comparator = lookup (reader, fieldname, type,
locale, factory);
+    ScoreDocComparator comparator = null;
+    if( type != SortField.CUSTOM )
+       comparator = lookup (reader, fieldname, type, locale, factory);
    if (comparator == null) {
      switch (type) {
        case SortField.AUTO:
@@ -204,7 +206,8 @@
        default:
          throw new RuntimeException ("unknown field type: "+type);
      }
-      store (reader, fieldname, type, locale, factory, comparator);
+      if( type != SortField.CUSTOM )
+         store (reader, fieldname, type, locale, factory, comparator);
    }
    return comparator;
  }
===== FieldSortedHitQueue.java patch =====

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to