[Namazu-cvs 745] r210 - Search-Namazu/trunk

cvsd @ vaj.namazu.org cvsd @ vaj.namazu.org
2006年 3月 23日 (木) 16:52:26 JST


Author: knok
Date: 2006-03-23 16:52:25 +0900 (Thu, 23 Mar 2006)
New Revision: 210

Modified:
   Search-Namazu/trunk/ChangeLog
   Search-Namazu/trunk/Namazu.pm
   Search-Namazu/trunk/Namazu.xs
Log:
Added errno check.


Modified: Search-Namazu/trunk/ChangeLog
===================================================================
--- Search-Namazu/trunk/ChangeLog	2006-03-16 06:39:32 UTC (rev 209)
+++ Search-Namazu/trunk/ChangeLog	2006-03-23 07:52:25 UTC (rev 210)
@@ -1,3 +1,7 @@
+2006-03-23  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
+
+	* Namazu.{xs,pm} : Added errno check.
+
 2006-03-16  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
 
 	* t/01-mkindex.t: Removed some environment variables.

Modified: Search-Namazu/trunk/Namazu.pm
===================================================================
--- Search-Namazu/trunk/Namazu.pm	2006-03-16 06:39:32 UTC (rev 209)
+++ Search-Namazu/trunk/Namazu.pm	2006-03-23 07:52:25 UTC (rev 210)
@@ -212,6 +212,9 @@
 sub NMZ_ERR_EMPTY_QUERY { return -3; }
 sub NMZ_ERR_RESULT_EXCEEDED { return -4; }
 
+# errno
+sub ERR_TOO_MUCH_HIT { return 6; }
+
 sub Search {
     my %args = @_;
     my $index = $args{'index'};
@@ -279,6 +282,11 @@
 
     my @hlists = call_search_main($query);
 
+    my $errno = nmz_geterrno();
+    if ($errno == ERR_TOO_MUCH_HIT) {
+	return NMZ_ERR_RESULT_EXCEEDED;
+    }
+
 # return objects
     return @hlists;
 }

Modified: Search-Namazu/trunk/Namazu.xs
===================================================================
--- Search-Namazu/trunk/Namazu.xs	2006-03-16 06:39:32 UTC (rev 209)
+++ Search-Namazu/trunk/Namazu.xs	2006-03-23 07:52:25 UTC (rev 210)
@@ -42,6 +42,7 @@
 #include <namazu/search.h>
 #include <namazu/util.h>
 #include <namazu/wakati.h>
+#include <errno.h>
 #ifdef __cplusplus
 }
 #endif
@@ -172,3 +173,10 @@
 nmz_setmaxhit(int max)
 	CODE:
 		nmz_set_maxhit(max);
+
+int
+nmz_geterrno()
+	CODE:
+		RETVAL = errno
+	OUTPUT:
+		RETVAL




Namazu-cvs メーリングリストの案内