Revision: 16672
          http://sourceforge.net/p/gate/code/16672
Author:   valyt
Date:     2013-05-02 14:48:29 +0000 (Thu, 02 May 2013)
Log Message:
-----------
Removed optimisation of dubious value: we now memory-map all indexes, instead 
of trying to memory-load smaller ones.

Modified Paths:
--------------
    mimir/trunk/mimir-core/src/gate/mimir/search/QueryEngine.java
    mimir/trunk/mimir-core/src/gate/mimir/util/MG4JTools.java

Modified: mimir/trunk/mimir-core/src/gate/mimir/search/QueryEngine.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/search/QueryEngine.java       
2013-05-02 14:12:37 UTC (rev 16671)
+++ mimir/trunk/mimir-core/src/gate/mimir/search/QueryEngine.java       
2013-05-02 14:48:29 UTC (rev 16672)
@@ -905,7 +905,7 @@
     
     try {
       File mg4JIndexDir = new File(indexDir, Indexer.MG4J_INDEX_DIRNAME);
-      // Load the token indexes as memory mapped, if possible
+      // Load the token indexes
       for(int i = 0; i < indexConfig.getTokenIndexers().length; i++) {
         File indexBasename =
           new File(mg4JIndexDir, Indexer.MG4J_INDEX_BASENAME + "-"

Modified: mimir/trunk/mimir-core/src/gate/mimir/util/MG4JTools.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/util/MG4JTools.java   2013-05-02 
14:12:37 UTC (rev 16671)
+++ mimir/trunk/mimir-core/src/gate/mimir/util/MG4JTools.java   2013-05-02 
14:48:29 UTC (rev 16672)
@@ -133,42 +133,9 @@
     Index theIndex = null;
     String basename = indexUri.toString();
     try {
-      // Optimisations: if the index size (i.e. index + positions files) is
-      // less than 64MB, then we load the index in memory,
-      // otherwise we memory-map it.
-      long size = 0;
-      File aFile =
-        new File(URI.create(basename + DiskBasedIndex.INDEX_EXTENSION));
-      if(aFile.exists()) {
-        size += aFile.length();
-      } else {
-        // mg4j-5+ may use quasi-succinct indexes
-        File anotherFile =
-            new File(URI.create(basename + 
DiskBasedIndex.POINTERS_EXTENSIONS));
-        if(anotherFile.exists()) {
-          size += anotherFile.length();
-        } else {
-          // mg4j-5+ may use quasi-succinct indexes
-          // no index file!
-          throw new IllegalArgumentException(
-              "Could not locate the index file at " +
-              aFile.getAbsolutePath() + ", nor at " +
-              anotherFile.getAbsolutePath() + "!");
-        }
-      }
-      aFile =
-        new File(URI.create(basename + DiskBasedIndex.POSITIONS_EXTENSION));
-      if(aFile.exists()) {
-        size += aFile.length();
-      } else {
-        // probably a direct index with no positions
-      }
-      String options = "?" + (size <= QueryEngine.MAX_IN_MEMORY_INDEX ? 
-          UriKeys.INMEMORY.toString().toLowerCase() + "=1" : 
-          (UriKeys.MAPPED.name().toLowerCase() + "=1;" + 
-           UriKeys.OFFSETSTEP.toString().toLowerCase() + "=-" + 
-           DiskBasedIndex.DEFAULT_OFFSET_STEP ));
-      
+      String options = "?" + UriKeys.MAPPED.name().toLowerCase() + "=1;" + 
+          UriKeys.OFFSETSTEP.toString().toLowerCase() + "=-" + 
+          DiskBasedIndex.DEFAULT_OFFSET_STEP;
       logger.debug("Opening index: " + basename + options);
       theIndex = Index.getInstance(basename + options, true, true);
     } catch(IOException e) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to