Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-2849

StringIndexOutOfBoundsException on searchtime

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.0.2
    • None
    • modules/benchmark
    • None
    • Windows XP

    • New

    Description

      I've been trying to run the example PrecisionRecall.java code from Lucene in Action II (downloaded the code, so its just as in the book). It gives a StringIndexOutOfBoundsException on my machine.

      Figured it out. I copied QualityBenchmark and QualityStats from the Lucene source and inserted a debugline to get a view of the argument values in the function that throws the exception.

      private String fracFormat(String frac) {
      int k = frac.indexOf('.');
      String s1 = padd+frac.substring(0,k);
      int n = Math.max(k,6);
      s1 = s1.substring(s1.length()-n);
      return s1 + frac.substring(k);
      }

      This function assumes that a decimal '.' is being used. However, the PC's we use over here at uni have a different locale using a ',' for decimals. Think you might be able to catch that by using (new DecimalFormatSymbols().getDecimalSeparator()) instead of ('.')?

      Attachments

        1. LUCENE-2849.patch
          1 kB
          Jeroen Vuurens

        Activity

          People

            Unassigned Unassigned
            jeoen Jeroen Vuurens
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified