[Namazu-cvs 763] r251 - Search-Namazu/trunk/Search-Namazu

cvsd @ vaj.namazu.org cvsd @ vaj.namazu.org
2006年 3月 30日 (木) 15:40:24 JST


Author: knok
Date: 2006-03-30 15:40:23 +0900 (Thu, 30 Mar 2006)
New Revision: 251

Modified:
   Search-Namazu/trunk/Search-Namazu/ChangeLog
   Search-Namazu/trunk/Search-Namazu/Namazu.pm
Log:
Changed value check.


Modified: Search-Namazu/trunk/Search-Namazu/ChangeLog
===================================================================
--- Search-Namazu/trunk/Search-Namazu/ChangeLog	2006-03-30 06:29:14 UTC (rev 250)
+++ Search-Namazu/trunk/Search-Namazu/ChangeLog	2006-03-30 06:40:23 UTC (rev 251)
@@ -1,7 +1,8 @@
 2006-03-30  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
 
 	* Namazu.pm (Search): Added "sortField" method.
-	  Fixed constants.
+	  //Fixed constants. - reverted
+	  Changed value check.
 
 	* Namazu.xs (call_search_main): Fixed half of results bug.
 	  (Reported by Tadamasa Teranishi, thank you)

Modified: Search-Namazu/trunk/Search-Namazu/Namazu.pm
===================================================================
--- Search-Namazu/trunk/Search-Namazu/Namazu.pm	2006-03-30 06:29:14 UTC (rev 250)
+++ Search-Namazu/trunk/Search-Namazu/Namazu.pm	2006-03-30 06:40:23 UTC (rev 251)
@@ -244,11 +244,11 @@
 
 use Carp;
 
-sub NMZ_SORTBYSCORE { return 0; }
 sub NMZ_SORTBYDATE { return 1; }
-sub NMZ_SORTBYFIELD { return 2; }
-sub NMZ_ASCENDSORT { return 0; }
-sub NMZ_DESCENDSORT { return 1; }
+sub NMZ_SORTBYSCORE { return 2; }
+sub NMZ_SORTBYFIELD { return 3; }
+sub NMZ_ASCENDSORT { return 16; }
+sub NMZ_DESCENDSORT { return 32; }
 
 sub NMZ_NOT_SPECIFIED_INDEX { return -1; }
 sub NMZ_ERR_INDEX { return -2; }
@@ -262,9 +262,9 @@
 sub Search {
     my %args = @_;
     my $index = $args{'index'};
-    my $sortmeth = $args{'sortMethod'};
-    my $sortord = $args{'sortOrder'};
-    my $sortfield = $args{'sortField'};
+    my $sortmeth = $args{'sortMethod'} || -1;
+    my $sortord = $args{'sortOrder'} || -1;
+    my $sortfield = $args{'sortField'} || -1;
     my $lang = $args{'lang'};
     my $query = $args{'query'};
     my $maxhit = $args{'maxhit'} || 10000;
@@ -293,10 +293,8 @@
 
 # set paramater
 
-    if (!defined $sortmeth) {
+    if ( $sortmeth == NMZ_SORTBYDATE) {
 	nmz_sortbydate();
-    } elsif ( $sortmeth == NMZ_SORTBYDATE) {
-	nmz_sortbydate();
     } elsif ($sortmeth == NMZ_SORTBYSCORE) {
 	nmz_sortbyscore();
     } elsif ($sortfield && $sortmeth == NMZ_SORTBYFIELD) {
@@ -306,10 +304,8 @@
 	nmz_sortbydate();
     }
 
-    if (!defined $sortord) {
+    if ($sortord == NMZ_DESCENDSORT) {
 	nmz_descendingsort();
-    } elsif ($sortord == NMZ_DESCENDSORT) {
-	nmz_descendingsort();
     } elsif ($sortord == NMZ_ASCENDSORT) {
 	nmz_ascendingsort();
     } else {
@@ -323,7 +319,7 @@
 
 # query and get hlist
 
-    if (! defined $query) {
+    if (!defined $query) {
 	return NMZ_ERR_RESULT_EXCEEDED;
     }
 




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