[Groonga-commit] groonga/gcs [master] Apply FacetEnabled of index fields for the search API

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Wed Aug 22 17:18:16 JST 2012


YUKI Hiroshi	2012-08-22 17:18:16 +0900 (Wed, 22 Aug 2012)

  New Revision: 2b82fb65f5cd07cc2fa4ee4e6dcf8845c3820eec
  https://github.com/groonga/gcs/commit/2b82fb65f5cd07cc2fa4ee4e6dcf8845c3820eec

  Log:
    Apply FacetEnabled of index fields for the search API

  Modified files:
    lib/api/2011-02-01/search.js

  Modified: lib/api/2011-02-01/search.js (+12 -0)
===================================================================
--- lib/api/2011-02-01/search.js    2012-08-22 17:12:58 +0900 (ee20e07)
+++ lib/api/2011-02-01/search.js    2012-08-22 17:18:16 +0900 (e3bf77e)
@@ -188,6 +188,18 @@ exports.createHandler = function(context) {
     }
 
     if (facetParameter) {
+      var facetReturnableFields = domain.facetReturnableIndexFields
+                                    .map(function(field) {
+                                      return field.name;
+                                    });
+      facetParameter = facetParameter.split(',')
+                         .map(function(field) {
+                           return field.replace(/^\s+|\s+$/g, '');
+                         })
+                         .filter(function(field) {
+                           return facetReturnableFields.indexOf(field) > -1;
+                         });
+                         .join(',');
       options.drilldown = facetParameter;
       options.drilldown_sortby = '-_nsubrecs';
       // TODO support sorting parameter
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index