Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multi-Index] New "hierarchical" indexing?
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2009-07-13 16:54:18


On Sat, Jul 11, 2009 at 5:17 AM, JOAQUIN M. LOPEZ MUÑOZ<joaquin_at_[hidden]> wrote:
>> In another use case, entries have a "scenario" key, where scenario is
>> hierarchical, and I want all entries in BMI A from a given scenario
>> and all its ancestors, with the scenarios being in BMI B (i.e.
>> "cross-bmi"). Of course I can do a "full scan" but I'm looking for
>> something hopefully faster/smarter.
>
> Not entirely sure if the following is directly applicable to your
> problem, but anyway.

Thank you for taking the time to provide a full exemple. That's really nice!

>  typedef multi_index_container<
>    entry,
>    indexed_by<
>      ordered_non_unique<member<entry,scenario_t,&entry::scenario> >
>    >
>  > entry_container_t;

I'm currently using hashed indices only. Does the technique of using a
compatible key extend to them? (I suspect not in this case, but I
thought I'd ask, just in case I'm misunderstanding.)

> What is this? parent_t is just a sort of alias to scenario_t that
> allows us to differentiate between a "terminal" scenario and
> a scenario used for purposes of recursive lookup. children
> is a compatible (with the order of entry_container_t) compare
> predicate that levels off scenario paths in a way that, for
> instance, if we have parent "a" then "a/b", "a/d", "a/b/e" etc.
> are deemed equivalent to the parent.

I was thinking about such a Materialized Path impl, after reading
http://www.dbazine.com/oracle/or-articles/tropashko4 recently. But I
would not have been able to express it in an example as easily as you
could. I appreciate the leg up.

> Is this of any help to your particular problem?

I think it does. I'll need time to digest and adapt it, but it sounds
like Materialized Path with an ordered index will avoid a full scan.

Thanks again for your help. --DD


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net