lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gol...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/search SortComparator.java FieldSortedHitQueue.java
Date Wed, 29 Sep 2004 15:09:02 GMT
goller      2004/09/29 08:09:02

  Modified:    src/java/org/apache/lucene/search SortComparator.java
                        FieldSortedHitQueue.java
  Log:
  Patch for Bug# 31240. This patch hopefully removes a
  memory leak in the sort code.
  
  Revision  Changes    Path
  1.3       +3 -2      jakarta-lucene/src/java/org/apache/lucene/search/SortComparator.java
  
  Index: SortComparator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/SortComparator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SortComparator.java	10 Jul 2004 06:19:01 -0000	1.2
  +++ SortComparator.java	29 Sep 2004 15:09:02 -0000	1.3
  @@ -29,8 +29,9 @@
     public ScoreDocComparator newComparator (final IndexReader reader, final String fieldname)
     throws IOException {
       final String field = fieldname.intern();
  +    final Comparable[] cachedValues = FieldCache.DEFAULT.getCustom (reader, field, SortComparator.this);
  +    
       return new ScoreDocComparator() {
  -      protected Comparable[] cachedValues = FieldCache.DEFAULT.getCustom (reader, field,
SortComparator.this);
   
         public int compare (ScoreDoc i, ScoreDoc j) {
           return cachedValues[i.doc].compareTo (cachedValues[j.doc]);
  
  
  
  1.13      +5 -7      jakarta-lucene/src/java/org/apache/lucene/search/FieldSortedHitQueue.java
  
  Index: FieldSortedHitQueue.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/FieldSortedHitQueue.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FieldSortedHitQueue.java	18 Sep 2004 18:21:17 -0000	1.12
  +++ FieldSortedHitQueue.java	29 Sep 2004 15:09:02 -0000	1.13
  @@ -200,10 +200,9 @@
     static ScoreDocComparator comparatorInt (final IndexReader reader, final String fieldname)
     throws IOException {
       final String field = fieldname.intern();
  +    final int[] fieldOrder = FieldCache.DEFAULT.getInts (reader, field);
       return new ScoreDocComparator() {
   
  -      final int[] fieldOrder = FieldCache.DEFAULT.getInts (reader, field);
  -
         public final int compare (final ScoreDoc i, final ScoreDoc j) {
           final int fi = fieldOrder[i.doc];
           final int fj = fieldOrder[j.doc];
  @@ -232,10 +231,9 @@
     static ScoreDocComparator comparatorFloat (final IndexReader reader, final String fieldname)
     throws IOException {
       final String field = fieldname.intern();
  +    final float[] fieldOrder = FieldCache.DEFAULT.getFloats (reader, field);
       return new ScoreDocComparator () {
   
  -      protected final float[] fieldOrder = FieldCache.DEFAULT.getFloats (reader, field);
  -
         public final int compare (final ScoreDoc i, final ScoreDoc j) {
           final float fi = fieldOrder[i.doc];
           final float fj = fieldOrder[j.doc];
  @@ -264,8 +262,8 @@
     static ScoreDocComparator comparatorString (final IndexReader reader, final String fieldname)
     throws IOException {
       final String field = fieldname.intern();
  +    final FieldCache.StringIndex index = FieldCache.DEFAULT.getStringIndex (reader, field);
       return new ScoreDocComparator () {
  -      final FieldCache.StringIndex index = FieldCache.DEFAULT.getStringIndex (reader, field);
   
         public final int compare (final ScoreDoc i, final ScoreDoc j) {
           final int fi = index.order[i.doc];
  @@ -296,8 +294,8 @@
     throws IOException {
       final Collator collator = Collator.getInstance (locale);
       final String field = fieldname.intern();
  +    final String[] index = FieldCache.DEFAULT.getStrings (reader, field);
       return new ScoreDocComparator() {
  -      final String[] index = FieldCache.DEFAULT.getStrings (reader, field);
   
         public final int compare (final ScoreDoc i, final ScoreDoc j) {
           return collator.compare (index[i.doc], index[j.doc]);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message