[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [ENH] ability to select fields from list context to reduce memory usage -...

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68d11ac693816_2cdf0fc961d1@gitlab-sidekiq-low-urgency-cpu-bound-v2-5bf7764645-v8748.mail>

Victor Emanouilov pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
1bec30a4 by Victor Emanouilov at 2025-09-22T12:45:35+03:00
[ENH] ability to select fields from list context to reduce memory usage - especially useful for large indexes where calc/subtotal needs to run over many results

- - - - -


2 changed files:

- lib/core/Search/Elastic/Index.php
- lib/core/Search/Query/WikiBuilder.php


Changes:

=====================================
lib/core/Search/Elastic/Index.php
=====================================
@@ -403,6 +403,14 @@ class Search_Elastic_Index implements Search_Index_Interface, Search_Index_Query
                 ]];
             }
 
+            if ($selectFields = $query->getSelectionFields()) {
+                $sourcePart = [
+                    "_source" => $selectFields,
+                ];
+            } else {
+                $sourcePart = [];
+            }
+
             $indices = [$this->index];
 
             $foreign = array_map(function ($query) use ($builder) {
@@ -453,6 +461,7 @@ class Search_Elastic_Index implements Search_Index_Interface, Search_Index_Query
                 $facetPart,
                 $rescorePart,
                 $postFilterPart,
+                $sourcePart,
                 [
                     "from" => $resultStart,
                     "size" => $resultCount,


=====================================
lib/core/Search/Query/WikiBuilder.php
=====================================
@@ -124,6 +124,11 @@ class Search_Query_WikiBuilder
         $this->paginationArguments['max'] = max(1, (int) $value);
     }
 
+    public function wpquery_select_fields($query, $value)
+    {
+        $query->setSelectionFields(preg_split('/[, ]+/', $value));
+    }
+
     public function wpquery_filter_editable($query, $editableType, array $arguments)
     {
         $fields = $this->get_fields_from_arguments($arguments);



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1bec30a4ec120f8b2f5ab5bbd6ce205fe8e07103

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1bec30a4ec120f8b2f5ab5bbd6ce205fe8e07103
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.