Menu

#3 ClassCastException when using MultiSearcher

trunk
open
nobody
locallucene (2)
5
2008-01-24
2008-01-24
No

First of all; great work.

I've noticed a problem when trying to run TestDistance.testRange over a MultiSearcher, which is what we use (don't ask).

To recreate replace the first line in testRange():

searcher = new IndexSearcher(directory);

with

MultiSearcher searcher = new MultiSearcher(new Searchable[] { new IndexSearcher(directory) });

and the ClassCastException is thrown on FieldDocSortedHitQueue when it tries to cast the double into a float (which DistanceSortSource.DistanceScoreDocLookupComparator uses at its sortType).

This is happening during the merge sort that MultiSearcher does after every query - this would not have been picked up using a standard IndexSearcher.

Discussion

  • Robert Watts

    Robert Watts - 2008-01-24

    DistanceSortSource

     
  • Robert Watts

    Robert Watts - 2008-01-24

    Logged In: YES
    user_id=1990702
    Originator: YES

    I have a resolution.

    sortValue in DistanceSortSource.DistanceScoreDocLookupComparator was returning a double, hence causing the ClassCastException.

    I've attached a patch.
    File Added: DistanceSortSource.java

     
  • Nobody/Anonymous

    Logged In: NO

    I got the same problem too. The workaround is to modify DistanceSortSource.java to return 7 :
    public int sortType() {
    //return SortField.FLOAT;
    //return SortField.DOUBLE; - SortField.java needs to add this constant
    return 7; // SortField.DOUBLE;
    }

     

Log in to post a comment.