
Jeff
Hi,
I am having syntax issues and wish to search a bmi container by the composite index defined below. I have read about boost::lambdas and understand how they work. I simply have gotten stuck in the syntax to perform the get on the index and how to create the tuple(s) containing the proper objects.
I want to search such that searchKey1=”key1” and searchKey2=”key2” and ValidFrom is <= '2013-03-01' and ValidTo >= '2013-02-08'. Can anyone help me please?
Hi Jeff, There's no way to retrieve this range with a single lookup operation, basically because the elements satisfying the four criteria are not sorted to appear adjacently in the idx_test index. The closest you can get is * lookup for elements with searchKey1=”key1”, searchKey2=”key2”, ValidFrom <= '2013-03-01' * filter out from the latter range those elements with ValidTo >= '2013-02-08' which would look roughly like this (not tested): TestCache tc; ... date valid_to=date(from_string("2013-02-08")); for( auto it= tc.lower_bound(boost:make_tuple("key1","key2")), it_end=tc.upper_bound( boost:make_tuple("key1","key2",from_string("2013-03-01"))), it!=it_end;++it){ if(it->ValidTo>=valid_to){...} } HTH, Joaquín M López Muñoz Telefónica Digital