[TikiWiki-commits] [Git][tikiwiki/tiki][28.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 <68d11ad12bfc1_2c50ae3846570@gitlab-sidekiq-low-urgency-cpu-bound-v2-5bf7764645-z6swk.mail>

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


Commits:
1dd0c082 by Victor Emanouilov at 2025-09-22T12:45:45+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/1dd0c08202140dcb3539bc967a1a3adf62013ddf

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1dd0c08202140dcb3539bc967a1a3adf62013ddf
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.