[Namazu-cvs 761] r249 - Search-Namazu/trunk/Search-Namazu

cvsd @ vaj.namazu.org cvsd @ vaj.namazu.org
2006年 3月 30日 (木) 14:27:39 JST


Author: knok
Date: 2006-03-30 14:27:38 +0900 (Thu, 30 Mar 2006)
New Revision: 249

Modified:
   Search-Namazu/trunk/Search-Namazu/ChangeLog
   Search-Namazu/trunk/Search-Namazu/Namazu.pm
   Search-Namazu/trunk/Search-Namazu/Namazu.xs
Log:
Added "sortField" parameter.


Modified: Search-Namazu/trunk/Search-Namazu/ChangeLog
===================================================================
--- Search-Namazu/trunk/Search-Namazu/ChangeLog	2006-03-30 04:41:13 UTC (rev 248)
+++ Search-Namazu/trunk/Search-Namazu/ChangeLog	2006-03-30 05:27:38 UTC (rev 249)
@@ -1,5 +1,7 @@
 2006-03-30  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
 
+	* Namazu.pm (Search): Added "sortField" method.
+
 	* 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 04:41:13 UTC (rev 248)
+++ Search-Namazu/trunk/Search-Namazu/Namazu.pm	2006-03-30 05:27:38 UTC (rev 249)
@@ -130,6 +130,10 @@
 
 If you ommit this option, it is treated as same as NMZ_DESCENDSORT.
 
+=head3 sortField
+
+Specify field name when you specified sortMethod as NMZ_SORTBYFIELD.
+
 =head3 lang
 
 Specify language.
@@ -260,6 +264,7 @@
     my $index = $args{'index'};
     my $sortmeth = $args{'sortMethod'};
     my $sortord = $args{'sortOrder'};
+    my $sortfield = $args{'sortField'};
     my $lang = $args{'lang'};
     my $query = $args{'query'};
     my $maxhit = $args{'maxhit'} || 10000;
@@ -294,7 +299,8 @@
 	nmz_sortbydate();
     } elsif ($sortmeth == NMZ_SORTBYSCORE) {
 	nmz_sortbyscore();
-    } elsif ($sortmeth == NMZ_SORTBYFIELD) {
+    } elsif ($sortfield && $sortmeth == NMZ_SORTBYFIELD) {
+	nmz_setsortfield($sortfield);
 	nmz_sortbyfield();
     } else {
 	nmz_sortbydate();

Modified: Search-Namazu/trunk/Search-Namazu/Namazu.xs
===================================================================
--- Search-Namazu/trunk/Search-Namazu/Namazu.xs	2006-03-30 04:41:13 UTC (rev 248)
+++ Search-Namazu/trunk/Search-Namazu/Namazu.xs	2006-03-30 05:27:38 UTC (rev 249)
@@ -271,6 +271,12 @@
 		nmz_set_sortmethod(SORT_BY_SCORE);
 
 void
+nmz_setsortfield(field)
+	SV * field
+	CODE:
+		nmz_set_sortfield(SvPV_nolen(field));
+
+void
 nmz_sortbyfield()
 	CODE:
 		nmz_set_sortmethod(SORT_BY_FIELD);




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