← Back to team overview

uonedb-qt team mailing list archive

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

 

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

Commit message:
Store whole document contents in the results and unit test that

Requested reviews:
  PS Jenkins bot (ps-jenkins): continuous-integration
  U1DB Qt developers (uonedb-qt)
Related bugs:
  Bug #1271973 in U1DB Qt/ QML: "Results from U1db.Query contain only indexed fields, not the whole document"
  https://bugs.launchpad.net/u1db-qt/+bug/1271973

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

The original reason to avoid yielding all contents was in order to conserve memory. I pondered different approaches such as lazily loading the data in the model implementation. Ultimately this would make it more complicated and harder to test, so given the number of bugs I'm focussing on the easy, reliable solution. It can be optimized later.
-- 
https://code.launchpad.net/~kalikiana/u1db-qt/entireContentsInQuery/+merge/203058
Your team U1DB Qt developers is requested to review the proposed merge of lp:~kalikiana/u1db-qt/entireContentsInQuery into lp:u1db-qt.
=== modified file 'src/query.cpp'
--- src/query.cpp	2013-08-27 10:49:26 +0000
+++ src/query.cpp	2014-01-24 12:59:52 +0000
@@ -148,7 +148,7 @@
             if (!m_documents.contains(docId) && result_variant.isValid())
             {
                 m_documents.append(docId);
-                m_results.append(result);
+                m_results.append(m_index->getDatabase()->getDocUnchecked(docId));
             }
         }
 

=== modified file 'tests/tst_query.qml'
--- tests/tst_query.qml	2013-08-27 10:49:26 +0000
+++ tests/tst_query.qml	2014-01-24 12:59:52 +0000
@@ -159,6 +159,8 @@
         // 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]))
     }
 
     function test_2_numbers () {