Sounds like you want a Database; you can use:
var db = LocalStorage.openDatabaseSync(“DataBaseName”, “1.0”, “Description”, 1000000);
then run SQL to get record(s)
var results = tx.executeSql(“SELECT theField FROM theDataTable WHERE theField=?;”, whatIamLookingFor);
Its the only way I can think of how to do this efficiently.
LocalStorage can be used to store single key value pairs; or a Database, I think SQLite is the only option here, this is JavaScript, this support is built in, just import QtQuick.LocalStorage 2.0; you can also do this in in C++ if you need to support more databases; depending on your needs and platforms you need to support; you will need a driver if use QtDatabase
http://doc.qt.io/qt-5/sql-driver.html#building-the-plugins-manually
you can see here what Databases it supports; which is most of them.
JavaScript LocalStorage is very powerful; but C++ is more powerful, it all depends on your Comfort zone; there are also Libraries out there like:
JavaScript
https://github.com/danielfranca/quickmodel
C++
https://github.com/JosephMillsAtWork/QmlSql
I have not used either; but plan on using both. I have to test them on all Platforms before I recommend them; but having looked at the Code; I would say they are well written and easy to use, and should would on all Platforms that Qt supports; but if you link against the C++ library; make sure you compile it for all the Platforms you will support; or just compile it into your app; there are example of how to integrate this with QML; so its a matter of writing your own Library or using one that someone else wrote; either way these two projects will show you the code and how to use it.