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

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


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

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