← Back to team overview

uonedb-qt team mailing list archive

[Merge] lp:~kalikiana/u1db-qt/revertResultFields into lp:u1db-qt

 

Christian Dywan has proposed merging lp:~kalikiana/u1db-qt/revertResultFields into lp:u1db-qt.

Commit message:
Revert r113 and update unit test to verify previous behavior

Requested reviews:
  PS Jenkins bot (ps-jenkins): continuous-integration
  U1DB Qt developers (uonedb-qt)

For more details, see:
https://code.launchpad.net/~kalikiana/u1db-qt/revertResultFields/+merge/210890

Revert the Query change from r113 and change the unit test to verify the previous behavior (there was no test for this before).
-- 
https://code.launchpad.net/~kalikiana/u1db-qt/revertResultFields/+merge/210890
Your team U1DB Qt developers is requested to review the proposed merge of lp:~kalikiana/u1db-qt/revertResultFields into lp:u1db-qt.
=== modified file 'src/query.cpp'
--- src/query.cpp	2014-03-07 17:54:07 +0000
+++ src/query.cpp	2014-03-13 19:34:27 +0000
@@ -175,7 +175,7 @@
             if (!m_documents.contains(docId) && result_variant.isValid())
             {
                 m_documents.append(docId);
-                m_results.append(m_index->getDatabase()->getDocUnchecked(docId));
+                m_results.append(result);
             }
         }
 

=== modified file 'tests/tst_query.qml'
--- tests/tst_query.qml	2014-03-07 17:54:07 +0000
+++ tests/tst_query.qml	2014-03-13 19:34:27 +0000
@@ -299,8 +299,11 @@
         // Results are also equivalent
         compare(defaultPhone.results.length, allPhoneKeywords.results.length , 'siete')
         compare(defaultPhone.results, allPhoneKeywords.results, 'seis')
-        // Results are whole contents
-        compare(defaultPhone.results[0], gents.getDoc(gents.listDocs()[0]))
+        // Results are lists of matching index fields with their values
+        var firstDocId = gents.listDocs()[0]
+        compare(defaultPhone.documents[0], firstDocId)
+        var firstContents = gents.getDoc(firstDocId)
+        compare(defaultPhone.results[0], {"phone": firstContents.gents[0].phone})
     }
 
     function test_2_numbers () {