]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/engine/Index.java
Attempt to fix issue #49.
[Dictionary.git] / src / com / hughes / android / dictionary / engine / Index.java
index d9d17bf24be41f2cfa2b3c177c3196e8a0bae286..069cca798219be68e046be0bccd0115843c6dd92 100644 (file)
@@ -13,7 +13,7 @@
 // limitations under the License.
 
 /**
- * 
+ *
  */
 
 package com.hughes.android.dictionary.engine;
@@ -117,7 +117,7 @@ public final class Index implements RAFSerializable<Index> {
      * normalizations.
      */
     public NormalizeComparator getSortComparator() {
-        return new NormalizeComparator(normalizer(), sortLanguage.getCollator());
+        return new NormalizeComparator(normalizer(), sortLanguage.getCollator(), dict.dictFileVersion);
     }
 
     public Index(final Dictionary dict, final DataInput inp) throws IOException {
@@ -137,7 +137,7 @@ public final class Index implements RAFSerializable<Index> {
         }
         sortedIndexEntries = CachingList.create(
                 RAFList.create(raf, indexEntrySerializer, raf.getFilePointer(),
-                               dict.dictFileVersion), CACHE_SIZE);
+                               dict.dictFileVersion, dict.dictInfo + " idx " + languageCode + ": "), CACHE_SIZE);
         if (dict.dictFileVersion >= 7) {
             int count = StringUtil.readVarInt(raf);
             stoplist = new HashSet<String>(count);
@@ -244,7 +244,8 @@ public final class Index implements RAFSerializable<Index> {
             } else if (index.dict.dictFileVersion >= 6) {
                 this.htmlEntries = CachingList.create(
                         RAFList.create((RandomAccessFile)raf, index.dict.htmlEntryIndexSerializer,
-                                ((RandomAccessFile)raf).getFilePointer(), index.dict.dictFileVersion), 1);
+                                ((RandomAccessFile)raf).getFilePointer(), index.dict.dictFileVersion,
+                                index.dict.dictInfo + " htmlEntries: "), 1);
             } else {
                 this.htmlEntries = Collections.emptyList();
             }
@@ -309,7 +310,9 @@ public final class Index implements RAFSerializable<Index> {
             }
             final IndexEntry midEntry = sortedIndexEntries.get(mid);
 
-            final int comp = sortCollator.compare(token, midEntry.normalizedToken());
+            int comp = NormalizeComparator.compareWithoutDash(token, midEntry.normalizedToken(), sortCollator, dict.dictFileVersion);
+            if (comp == 0)
+                comp = sortCollator.compare(token, midEntry.normalizedToken());
             if (comp == 0) {
                 final int result = windBackCase(token, mid, interrupted);
                 return result;