Hi! Here is my proposal of a new libzypp API for various metadata queries. It should be useful for YaST package managers, zypper, YaST online update and maybe others. Pease see attached QueryBuilder.h file and comment on the design and usability. QueryBuilder is meant to build an sqlite query for libzypp's metadata cache database and to be used by ResolvableQuery::query(QueryBuilder,ProcessingFunctor) function (or other Query class) to do complex resolvable data queries. Result of these queries will be processed by ProcessingFunctor (read on). The reason to create such an API is to have a convenient API for coding various kinds of user queries, so that apps using libzypp don't have to code the functionality by themselves by traversing the resolvable pool. And since we (will hopefully) have the new metadata cache database, there is another reason: to make use of the database to speed up the search and save memory requirements (don't load the pool, just query the database). I would have to code it once in zypper anyway, so this way it can be reused by others as well. CODE EXAMPLE: //////// code START ///////////////////////////////////////// bool is_regexp; // treat the search string as regexp? bool search_summaries; // search also in summaries? string search_string; // user given search string Resolvable::Kind kind; // the result will be limited to this kind <snip> zypp::cache::QueryBuilder builder; builder.addName(search_string, is_regexp); if (search_summaries) builder.addAttribute(zypp::cache::attrResObjectSummary(), search_string, is_regexp); builder.addKind(kind); zypp::cache::ResolvableQuery resquery; resquery.query(builder, processing_functor); //////// code END ///////////////////////////////////////// (the functor is function<bool( const data::RecordId &, data::ResObject_Ptr )> we can provide one which would use Selectables (or NameKindProxy) for yast as well) FEATURES - search by name, any cache attribute, kind, (future: installed status), version - uses simple strings or regexes - search by dependencies (select resolvables which are required by e.g. pattern X) - use multiple search conditions and choose to require all or any of them satisfied. IMPLEMENTATION - based on given arguments and options, an sqlite command will be built This command will be executed by a ResolvableQuery::query() or another Query class (see attachment - just a stub). - i decided to write field values into the sqlite command string itself. Using variable names and bind values to them would be too complex. - regexes - sqlite's REGEXP keyword will be used, bound to user (libzypp) defined regexp matching function of our liking. ISSUES - what regexp syntax do we want to support? - something missing/to be changed in the API? Cheers, Jano