changeset 475:fd890d2b38da

modified point-bits coding for indexing (BREAKS BACKWARDS COMPATIBILITY). Plugged file-descriptor leak in index.cpp
author mas01mc
date Fri, 09 Jan 2009 22:12:57 +0000
parents f9d86b1db21c
children a7193678280b
files Makefile create.cpp index.cpp query.cpp
diffstat 4 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Jan 09 18:05:32 2009 +0000
+++ b/Makefile	Fri Jan 09 22:12:57 2009 +0000
@@ -71,7 +71,7 @@
 
 
 clean:
-	-rm cmdline.c cmdline.h
+	-rm cmdline.c cmdline.h cmdline.o
 	-rm soapServer.cpp soapClient.cpp soapC.cpp soapObject.h soapStub.h soapProxy.h soapH.h soapServerLib.cpp soapClientLib.cpp
 	-rm adb.*
 	-rm HELP.txt
--- a/create.cpp	Fri Jan 09 18:05:32 2009 +0000
+++ b/create.cpp	Fri Jan 09 22:12:57 2009 +0000
@@ -55,11 +55,11 @@
   // For backward-compatibility, Record the point-encoding parameter for LSH indexing in the adb header
   // If this value is 0 then it will be set to 14
 
-  //#if O2_LSH_N_POINT_BITS > 28
-  //#error "AudioDB Compile ERROR: consistency check of O2_LSH_POINT_BITS failed (>15)"
-  //#endif
+  #if LSH_N_POINT_BITS > 31
+  #error "AudioDB Compile ERROR: consistency check of O2_LSH_POINT_BITS failed (>31)"
+  #endif
   
-  dbH->flags |= LSH_N_POINT_BITS << 28;
+  dbH->flags |= LSH_N_POINT_BITS << 27;
 
   // If database will fit in a single file the vectors are copied into the AudioDB instance
   // Else all the vectors are left on the FileSystem and we use the dataOffset as storage
--- a/index.cpp	Fri Jan 09 18:05:32 2009 +0000
+++ b/index.cpp	Fri Jan 09 22:12:57 2009 +0000
@@ -589,6 +589,7 @@
   else
     set_up_query(&query_data, &query, &qNorm, &qnPtr, &qPower, &qpPtr, &meanQdur, &numVectors); // get query vectors
 
+  close(infid); // Free up this file handle
   VERB_LOG(1, "retrieving tracks...");
   
   assert(pointNN>0 && pointNN<=O2_MAXNN);
--- a/query.cpp	Fri Jan 09 18:05:32 2009 +0000
+++ b/query.cpp	Fri Jan 09 22:12:57 2009 +0000
@@ -70,10 +70,20 @@
     }
     break;
   case O2_ONE_TO_ONE_N_SEQUENCE_QUERY :
+    if(no_unit_norming)
+      normalizedDistance = false;
     if(radius == 0) {
       error("query-type not yet supported");
-    } else {
-      reporter = new trackSequenceQueryRadNNReporterOneToOne(pointNN,trackNN, dbH->numFiles);
+    }
+    else {
+      if(index_exists(dbName, radius, sequenceLength)){
+	char* indexName = index_get_name(dbName, radius, sequenceLength);
+	lsh = index_allocate(indexName, false);
+	reporter = new trackSequenceQueryRadNNReporterOneToOne(pointNN,trackNN, index_to_trackID(lsh->get_maxp(), lsh_n_point_bits)+1);
+	delete[] indexName;
+      } 
+      else
+	reporter = new trackSequenceQueryRadNNReporterOneToOne(pointNN,trackNN, dbH->numFiles);
     }
     break;
   default: