Query model doesn't work properly with a multilevel document list
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
U1DB Qt/ QML |
Fix Committed
|
Undecided
|
Unassigned | ||
Ubuntu Music App |
Triaged
|
Medium
|
Unassigned | ||
u1db-qt (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
While using a Query model in a listview, I have noticed a weird scenario where it happens to kick out some index fields. Here is the code I used. Starting of with the document, index and query definitions,
U1db.Document {
database: appDb
docId: 'eyeOfTheTiger'
create: true
defaults: { "playlist": { "name": "oldies", "tracks": [ { "file": "old1", "title": "very old song" },{ "file": "old2", "title": "even older" } ] } }
}
U1db.Index{
database: appDb
id: by_playlist
expression: ["playlist.name", "playlist.
}
U1db.Query{
id: aQuery
index: by_playlist
query: [{"name":"*"}, {"file":"*"}, {"title":"*"}]
}
Here below is the listview where this query model is used.
ListView {
id: playlistView
model: aQuery
clip: true
anchors {
}
}
}
}
On running the program, I get the output referring to contents.name as undefined.
Unable to assign [undefined] to QString
Here is the strange part, If I change the index expression to ["playlist.name", "playlist.tracks"], then contents.name seems to be properly displayed. However now we lose the playlist.tracks field. This only happens when there are multiple layer lists in a document. If they are on the same level, it seems to work fine.
Related branches
- Benjamin Zeller: Approve
- PS Jenkins bot: Approve (continuous-integration)
-
Diff: 849 lines (+195/-488)7 files modifiedexamples/CMakeLists.txt (+1/-1)
examples/bookmarks/bookmarks.qml (+131/-450)
examples/u1db-qt-example-4/u1db-qt-example-4.qdoc (+0/-24)
src/index.cpp (+6/-2)
src/query.cpp (+16/-8)
src/query.h (+2/-2)
tests/tst_query.qml (+39/-1)
Changed in music-app: | |
status: | New → Triaged |
Here is a sample test program which indicates the issue.