sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods |   22 +++++++--------
 sc/source/core/data/table3.cxx                           |    9 ------
 2 files changed, 11 insertions(+), 20 deletions(-)

New commits:
commit 4967ac966be3bc84e5db210f6d5d96d45c877db7
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Nov 16 01:30:24 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Nov 18 09:48:56 2021 +0100

    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.kagan...@collabora.com>
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>
    (cherry picked from commit 8dec2a98ce29251936cd45ebf864a89ff767ee50)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125350
    Tested-by: Luboš Luňák <l.lu...@collabora.com>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

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 d315de4768cb..d57f405111a8 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2761,11 +2761,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(
@@ -2797,14 +2792,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;

Reply via email to