directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garbage <>
Subject Re: [ApacheDS] how can a partition return more than one result ?
Date Fri, 08 Jun 2012 12:05:57 GMT

Am 08.06.2012 um 13:58 schrieb Emmanuel Lécharny <>:

> Le 6/8/12 1:49 PM, Garbage a écrit :
>> I learned a lot about the implementation of custom partitions and see the changes
in the API from search and lookup returning an Entry in 1.5.x and an EntryFilteringCursor
later on.
>> I even was able to change an existing partition (shame on me: based on the 1.5.5
example, but I will switch to 2.0 soon) in a way that lets it return a fake group object that
was created in my custom POJO.
>> But I am only able to return ONE entry, I didn't find or understand the concept how
MULTIPLE entries can be returned. Can someone show me the right direction ?
> The idea is to use a Cursor that maps around the partition and fetch the entries one
by one.
> The way the server works is that based on your filter, you select the right index to
use to fetch the entries. There are may possibilities here :
> - first, you may have to do a full scan (the filter is not selective enough, for instance).
In this case, you don't use any index, you just use the MasterTable to get the entries. Now,
for each entry you fetch, you'll have to filter them to see if it's a valid entry - or not.
> - or you can select an index. You will fetch the index elements, and for each of them,
fetch the associated entry.  Once done, you can check against the filter if the entry is valid
- or not
> In any case, the cursor is your friend here : it maps the next() operation on top of
your index.
> Now, if your Partition is a Btree, it's easier, as the AbstractBTreePartition class already
handles everyting for you. If you don't inherit from this Abstract class, then it's way more
complicated. I'll suggest you have a look at the AbstractBTreePartition to get a clue about
how we process a search over a BTree based partition.
> -- 
> Regards,
> Cordialement,
> Emmanuel Lécharny

Thanks, I will investigate this. What a pity, I am able to map searches to string arrays containing
the name of groups I want to return. But I understand why you don't support arrays directly,
I will somehow manage to map to the Bree example. And if not I will show up here again ;-)

View raw message