summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-11-16 01:30:24 +0100
committerMichael Meeks <michael.meeks@collabora.com>2021-11-19 16:44:10 +0100
commit12bda3a60ea0b23668c26f275e970775e3fc68c2 (patch)
treec500ee69335c709aff6352afe72a91d95fcb46a9
parent8037a24dad50d98bd36ddc0f94d98d208ae3788d (diff)
revert "vlookup - optimize SC_EQUAL and NOT_EQUAL." (tdf#139612)
That commit breaks lookup when the "Search criteria = and <> must apply to whole cells" option is disabled, as it enforces whole cell checking regardless of the option. Given that the option is enabled by default in LO ('SearchCriteria' in Calc.xcs) and it's what MSOffice does as well, and this default gives good performance regardless of the option, I don't understand the purpose of the commit. Possibly it was based on a document where somebody disabled the option and then indeed got worse performance. Solution: Don't do that :). This reverts the code parts of a953fa1c0f6a40a08859570516c511f3a841 . The test I've kept but switched to ensure that partial matching does work if the option to match whole cells is disabled. I've also changed the tooltip for the option to mention performance and not suggest that off is the default. 7.2: UI string change not included. Change-Id: I56d7b6e7b8e9f0622f7ad6d447daf56c3b705a7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125267 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> (cherry picked from commit 8dec2a98ce29251936cd45ebf864a89ff767ee50) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125351 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods22
-rw-r--r--sc/source/core/data/table3.cxx9
2 files changed, 11 insertions, 20 deletions
diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods
index d47779d928a1..fd228881a7cb 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods
@@ -1017,14 +1017,14 @@
<text:p>TRUE</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
- <text:p>VLOOKUP tests that ensure there is no partial matching of cell contents</text:p>
+ <text:p>VLOOKUP tests that ensure there is partial matching of cell contents</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell/>
<table:table-cell table:style-name="ce8"/>
<table:table-cell office:value-type="string" calcext:value-type="string">
- <text:p>even though the document option of “search on whole cell” is turned off.</text:p>
+ <text:p>when the document option of “search on whole cell” is turned off.</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2" table:number-rows-repeated="29">
@@ -1095,10 +1095,10 @@
<table:table-cell table:style-name="ce22" table:formula="of:=VLOOKUP(&quot;ABC&quot;;[.$L$2:.$M$5];2;0)" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#N/A</text:p>
</table:table-cell>
- <table:table-cell table:formula="of:=#N/A" office:value-type="string" office:string-value="" calcext:value-type="error">
- <text:p>#N/A</text:p>
+ <table:table-cell office:value-type="float" office:value="2" calcext:value-type="float">
+ <text:p>2</text:p>
</table:table-cell>
- <table:table-cell table:style-name="ce25" table:formula="of:=ISERROR([.A2])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+ <table:table-cell table:style-name="ce25" table:formula="of:=[.A2]=[.B2]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
<text:p>TRUE</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce13" table:formula="of:=FORMULA([.A2])" office:value-type="string" office:string-value="=VLOOKUP(&quot;ABC&quot;,$L$2:$M$5,2,0)" calcext:value-type="string">
@@ -1122,10 +1122,10 @@
<table:table-cell table:formula="of:=VLOOKUP(&quot;BCD&quot;;[.$L$2:.$M$5];2;0)" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#N/A</text:p>
</table:table-cell>
- <table:table-cell table:formula="of:=#N/A" office:value-type="string" office:string-value="" calcext:value-type="error">
- <text:p>#N/A</text:p>
+ <table:table-cell office:value-type="float" office:value="2" calcext:value-type="float">
+ <text:p>2</text:p>
</table:table-cell>
- <table:table-cell table:style-name="ce25" table:formula="of:=ISERROR([.A3])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+ <table:table-cell table:style-name="ce25" table:formula="of:=[.A3]=[.B3]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
<text:p>TRUE</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce13" table:formula="of:=FORMULA([.A3])" office:value-type="string" office:string-value="=VLOOKUP(&quot;BCD&quot;,$L$2:$M$5,2,0)" calcext:value-type="string">
@@ -1149,10 +1149,10 @@
<table:table-cell table:formula="of:=VLOOKUP(&quot;BC&quot;;[.$L$2:.$M$5];2;0)" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#N/A</text:p>
</table:table-cell>
- <table:table-cell table:formula="of:=#N/A" office:value-type="string" office:string-value="" calcext:value-type="error">
- <text:p>#N/A</text:p>
+ <table:table-cell office:value-type="float" office:value="2" calcext:value-type="float">
+ <text:p>2</text:p>
</table:table-cell>
- <table:table-cell table:style-name="ce25" table:formula="of:=ISERROR([.A4])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+ <table:table-cell table:style-name="ce25" table:formula="of:=[.A4]=[.B4]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
<text:p>TRUE</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce13" table:formula="of:=FORMULA([.A4])" office:value-type="string" office:string-value="=VLOOKUP(&quot;BC&quot;,$L$2:$M$5,2,0)" calcext:value-type="string">
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 17d28013a680..8a92e17c3977 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2593,11 +2593,6 @@ public:
if (nIndex < 0)
nStrPos = -1;
- else if (rEntry.eOp == SC_EQUAL ||
- rEntry.eOp == SC_NOT_EQUAL)
- {
- nStrPos = pCellStr == pQuer ? 0 : -1;
- }
else
{ // OUString::indexOf
nStrPos = rtl_ustr_indexOfStr_WithLength(
@@ -2629,14 +2624,10 @@ public:
switch (rEntry.eOp)
{
case SC_EQUAL:
- bOk = ( nStrPos == 0 );
- break;
case SC_CONTAINS:
bOk = ( nStrPos != -1 );
break;
case SC_NOT_EQUAL:
- bOk = ( nStrPos != 0 );
- break;
case SC_DOES_NOT_CONTAIN:
bOk = ( nStrPos == -1 );
break;