/source/da/sysui/

kunlong.cn/lo/core' title='lo/core Git repository'/>
summaryrefslogtreecommitdiff
path: root/sc/inc/queryiter.hxx
AgeCommit message (Collapse)Author
2024-06-27Related: tdf#127293 Ignore 'search-criteria-must-apply-to-whole-cell'Balazs Varga
dependency for XLOOKUP and XMATCH because of better compatibility. The idea is to specify, that the global setting 'search-criteria-must-apply-to-whole-cell' is ignored and XMATCH and XLOOKUP always behaves as if 'search-criteria-must-apply-to-whole-cell'=true. That would affect exact search in Match_mode value 0. Users would need to use wildcard or regex to get a match to part of the content. But removing dependency to the global setting increases interoperability with MS Excel. Also the ODF TC will follow that in the final specification of these functions: https://issues.oasis-open.org/browse/OFFICE-4154 Follow-up commit: 17d578ba91f9c78a0e41d19b58183d2214c0b7a4 (Related: tdf#127293 Add new Match_mode option for XLOOKUP and XMATCH functions.) Change-Id: I1317865631d2925eaff72e9c1425d93386c3d016 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169582 Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> Reviewed-by: Regina Henschel <rb.henschel@t-online.de> Tested-by: Jenkins
2024-05-01Related: tdf#160725 - Add horizontal binary search mode for SortedCacheBalazs Varga
and ScSortedRangeCache classes to support binary search mode in case of different columns. Which is used by the new XLOOKUP function from now on in case of binary search mode. Change-Id: Ibb2ae33670cbe9b47110de57afb6376cd829b465 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166758 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
2024-04-30tdf#160725 - Fix XLOOKUP has different result for approximateBalazs Varga
search than Excel. Some rework for xlookup binary search in rows to get the correct results when we are searching with binary mode in rows. Change-Id: I7ef710c4ae638e2cf5d4bee45810cec7057f5d4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166451 Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> Tested-by: Jenkins
2024-04-02tdf#146619 Remove unused #includes from C/C++ filesRafał Dobrakowski
'sc' module was cleaned. Change-Id: Ia491d741a4c1c5314f35ebb4baa82dd516948ae7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165699 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-02-16Prepare search code for other functions than MATCH and XLOOKUP.Winfried Donkers
Purpose is to use one set of code for all similar lookup functions, as they now each have their own code, which is largely identical. Next steps will be to make the code used by XLOOKUP and MATCH work with each similar lookup function. This patch just changes the interface to accomodate other functions. Change-Id: I6950aa69404f3eb8acbf2d55e247058f3e798814 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163230 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
2024-02-09cid#1591767 Uninitialized scalar field (unused bSortedBinarySearch)Caolán McNamara
since: commit 68738bd0ac262819b13ea7e11af67ee493b9b3e1 Date: Thu Feb 1 14:36:24 2024 +0100 Related: tdf#127293 Fix function XLOOKUP binary search corner cases Change-Id: Idc6ce795779d264a67fff93da74ce5c45381940f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163164 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-02-08Related: tdf#127293 Fix function XLOOKUP binary search corner casesBalazs Varga
Fix some binary search (vertical) corner cases in case of XLOOKUP where we looking for the first matches. Change-Id: I6cdc778350989e0802ffc54284fdab9b8a2bece4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162877 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
2024-01-31tdf#127293 Add Excel2021 function XLOOKUP to CalcWinfried Donkers
https://issues.oasis-open.org/browse/OFFICE-4154 What is working already: xlookup with normal forward, backward search in columns/rows. Binary search in rows with real binary search algorithm, in columns only works with linear search yet. Linear forward backward wildcard/regex search in columns/rows. Looking for the first smaller or greater value with linear and binary search ALso all the combination of all these options. Except XLOOKUP not supperted wildcard/regex search with binary search. TODO in next patches: - add the binary search option for searching in columns. - Evaluate Formula calculation not working in general. Co-authored-by: Balazs Varga <balazs.varga.extern@allotropia.de> Change-Id: I15fd4479b63ec13b093d269760d1bbb5957553e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131905 Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
2022-06-26fix ByValue lookups with ScSortedRangeCacheLuboš Luňák
My fix for tdf#149071 actually disabled the optimization for all ByValue lookups, because in fact all such lookups have maString set. So lookups where the cells are a mix of numeric and string values need different handling. A simple solution is detecting such a mix when collecting the values for ScSortedRangeCache and disabling the optimization in such a case. But it turns out that queries containing such a mix are not that rare, as documents may e.g. do COUNTIF($C:$C) where the given column has numeric values that start with a textual header. So bail out only if the string cell actually could affect the numeric query. Also fix ScSortedRangeCache usage depending on query parameters, different instances are needed for e.g. different ScQueryOp, because the ScQueryEvaluator functions may return different results (isQueryByString() is automatically true for SC_EQUAL). Change-Id: Ib4565cbf6194e7c525c4d10d00b1c31707952a79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136403 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-11no PerformQuery() with ScSortedRangeCache if not needed (tdf#144777)Luboš Luňák
It should not be necessary in that case, since the rows are restricted only to those that match, selected by BinarySearch(). Still at least assert that, just in case I'm missing something (or BinarySearch() doesn't quite match what validQuery() does). Change-Id: Ie91d3ba997692e5b3650b1549e8a38b6c5f44c01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134130 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-11do not use ScSortedRangeCache inefficientlyLuboš Luňák
If the amount of data or size of the formula group is small, the caching is probably not worth it. And if rows are not absolute, then each formula cell would use a different range instead of reusing the cache. Change-Id: I42a82aaa5f4ffccc63e527793f46fc52fd539af6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134129 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-11make ScSortedRangeCache work for also ScQueryEntry::ByStringLuboš Luňák
Change-Id: Ifa769e20d91f7899fa81df537a7f3b7aeff52115 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134125 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-11use ScSortedRangeCache also for generic queriesLuboš Luňák
This enables use for e.g. VLOOKUP or COUNTIFS (as COUNTIFS does not use the specialized code for COUNTIF). Change-Id: Idad7503750d421f3f1c9ac34dfe95393fa3ead15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134124 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-11make internal ScQueryCellIteratorBase functions protectedLuboš Luňák
Nothing is using these outside of the class. Change-Id: If2e1f2ce30980adeb1ce007f6084f492b314dd5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134122 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-11introduce Calc cache for sorted handling of unsorted cellsLuboš Luňák
The idea is that there's a cache for a given range, which keeps a vector of SCROW items, sorted by values of those cells. This allows some specific cases of e.g. COUNTIF to simply use BinarySearch() to find the range that matches and work only with that. This commit implements using this cache for COUNTIF. Change-Id: I5b36b289b4aecb3b8245bbb447fbb299371262e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134120 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-11make it obvious which column BinarySearch() operates onLuboš Luňák
It was setting the column to ScQueryParams.nCol1, which was somewhat confusing. Change-Id: I3ab2207f507a4dc3782ea78682dacb0b08c36b19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134123 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-10sort out query iterator's BinarySearch() corner cases handlingLuboš Luňák
If the code detects the range is not actually properly sorted, set position to the first row and return false to force linear search. If the searched for value belongs before the first item, do the same, in which case the linear search should see that it is this case (before this case nRow was set to the first row regardless of where the searched for value belonged). Change-Id: I8ff346783d93d74ff409b19aea394e202885647d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134100 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-10make BinarySearch() work for SC_EQUAL, SC_LESS, SC_GREATERLuboš Luňák
Change-Id: I296686709688a9e3f2cda0864d73c79a17e33f49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134099 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-10extend ScQueryCellIteratorBase for custom cell accessLuboš Luňák
This moves code related to accessing cells to query to a template base class. Creating more specialization of that class will allow queries that use a cache of sort order for the cells. Change-Id: I47d1bc2d038717ff64f1d11fa6c7dba2359fec11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134096 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-10assert pre-requisities of BinarySearch()Luboš Luňák
Change-Id: I090a6538628eb5337a311ed8aec3580901e957ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134095 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-10BinarySearch() can be in ScQueryCellIteratorBaseLuboš Luňák
Change-Id: I89d7e58a9706526aa2871dba1e4f922ff94562a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134094 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-22do not duplicate code for ScCountIfCellIteratorLuboš Luňák
d468958331f36310d11265ba55d7c27366ab58ab improved COUNTIF performance by copy&pasting the generic query iterator and then basically removing what was not necessary. Which is in general a good way to improve the performance, except for the copy&paste part, as the code has already started to diverge (e.g. fc3b904b671a71266db2e8b30cbeeef4f79). So instead make the shared code into a template and reuse that from specific code. This has exactly the same performance as the copy&paste way. Change-Id: I168319a1f4273bafc8c0742a114dafbf433968bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133324 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-22move query-related iterators to a new separate fileLuboš Luňák
dociter.cxx/hxx are already quite big as it is, and the query iterators are more about queries than about iterating the document. Change-Id: I49e3a5636e4f366efb8b4968f54567d2716ade35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133323 Tested-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>