[Namazu-cvs 765] r254 - Search-Namazu/trunk/Search-Namazu

cvsd @ vaj.namazu.org cvsd @ vaj.namazu.org
2006年 4月 5日 (水) 10:37:52 JST


Author: knok
Date: 2006-04-05 10:37:51 +0900 (Wed, 05 Apr 2006)
New Revision: 254

Modified:
   Search-Namazu/trunk/Search-Namazu/ChangeLog
   Search-Namazu/trunk/Search-Namazu/Namazu.xs
Log:
Fixed search status info.


Modified: Search-Namazu/trunk/Search-Namazu/ChangeLog
===================================================================
--- Search-Namazu/trunk/Search-Namazu/ChangeLog	2006-04-03 07:43:30 UTC (rev 253)
+++ Search-Namazu/trunk/Search-Namazu/ChangeLog	2006-04-05 01:37:51 UTC (rev 254)
@@ -1,3 +1,7 @@
+2006-04-05  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
+
+	* Namazu.xs: Fixed search status info.
+
 2006-04-03  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
 
 	* Namazu.xs: Added 5 methods in ResultXS:

Modified: Search-Namazu/trunk/Search-Namazu/Namazu.xs
===================================================================
--- Search-Namazu/trunk/Search-Namazu/Namazu.xs	2006-04-03 07:43:30 UTC (rev 253)
+++ Search-Namazu/trunk/Search-Namazu/Namazu.xs	2006-04-05 01:37:51 UTC (rev 254)
@@ -65,20 +65,33 @@
 #define DOCID_LEN strlen(DOCID)
 #define IDXID "//idxid"
 #define IDXID_LEN strlen(IDXID)
-
+	
 static int status = 0;
 
+void set_status(void)
+{
+	int idxid;
+	status = SUCCESS;
+	for (idxid = 0; idxid < nmz_get_idxnum(); idxid ++) {
+	    struct nmz_hitnumlist *hnlist = nmz_get_idx_hitnumlist(idxid);
+	    while (hnlist != NULL) {
+	    	  if (hnlist->stat != SUCCESS)
+		     status = hnlist->stat;
+	    	  hnlist = hnlist->next;
+	    }
+	}
+}
+
 AV * call_search_main_c(char *query, int maxget)
 {
 	AV *retar;
 	NmzResult hlist;
 	char result[SEARCH_NAMAZU_FIELDS][BUFSIZE];
 	int i;
-	status = 0;
 	retar = newAV();
 	hlist = nmz_search(query);
 	av_extend(retar, hlist.num - 1);
-	status = hlist.stat;
+	set_status();
 	for (i = 0; i < hlist.num; i ++) {
 	    if (i < maxget) {
 		SV *ohlist = perl_eval_pv("new Search::Namazu::Result", TRUE);
@@ -128,7 +141,6 @@
 	flen = av_len(fields);
 	if (flen < 0 || maxget <= 0 || query == NULL)
 		return retar;
-	status = 0;
 	fstr = (char **) malloc(sizeof(char *) * (flen + 1));
 	fsize = (int *) malloc(sizeof(int) * (flen + 1));
 	for (i = 0; i <= flen; i ++) {
@@ -139,7 +151,7 @@
 	}
 	hlist = nmz_search(query);
 	av_extend(retar, hlist.num - 1);
-	status = hlist.stat;
+	set_status();
 	stash = gv_stashpv("Search::Namazu::ResultXS", 0);
 	for (i = 0; i < hlist.num; i ++) {
 		if (i < maxget) {




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