Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-04-30 14:48:24


On Mon, April 30, 2007 20:26, Manuel Jung wrote:
>> Try using the hashed_non_unique instead of ordered_non_unique index
>> implementation. This will use hashed values to access keys, and not a
>> comparison function.
>
> Would this really work? If i use the hashed_non_unique index, i cant use
> std::difference and "upper_bound" to get the count of same words, because
> it isnt sorted anymore?
> Or am i wrong?

Please take a look at:
http://www.boost.org/libs/multi_index/doc/reference/hash_indices.html#hash_indices

There is a member count (2 overloads), which can count all items with a given key or another
member equal_range (2 overloads), which ruturns the pair<iterator, iterator> for begin and end of
the range.

>> My personal opinion is that if your words are in the database anyway, you
>> should not retrieve them from there and then store them. SQL Solution will
>> be always faster, since databases knows how to optimize statements and
>> result sets as well.
>
> The original data comes not from the Database. I would do it then directly
> with a User Defined Function or Stored Procedure. But in my application the
> data is downloaded from the internet and is written to the DB after or
> before counting words. (Im counting it in the database with "INSERT ON
> DUPLICATE KEY UPDATE" statements.)

Ok, wanted to be sure. ;)

> Cheers
> Manu

With Kind Regards,

Ovanes Markarian


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