You can use the get() method to seek and retrieve the value. It will
return null if the key is not in the map. Something like:

Text value = (Text) indexReader.get(from, new Text());
while (value != null && ...)

Tom

On Thu, Jan 29, 2009 at 10:45 PM, schnitzi
<mark.schnitz...@fastsearch.com> wrote:
>
> Greetings all...  I have a situation where I want to read a range of keys and
> values out of a MapFile.  So I have something like this:
>
>    MapFile.Reader indexReader = new MapFile.Reader(fs, path.toString(),
> configuration)
>    boolean seekSuccess = indexReader.seek(from);
>    boolean readSuccess = indexReader.next(keyValue, value);
>    while (readSuccess && ...)
>
> The problem seems to be that while seekSuccess is returning true, when I
> call next() to get the value there, it's returning the value *after* the key
> that I called seek() on.  So if, say, my keys are Text("id0") through
> Text("id9"), and I seek for Text("id3"), calling next() will return
> Text("id4") and its associated value, not Text("id3").
>
> I would expect next() to return the key/value at the seek location, not the
> one after it.  Am I doing something wrong?  Otherwise, what good is seek(),
> really?
> --
> View this message in context: 
> http://www.nabble.com/MapFile.Reader-and-seek-tp21737717p21737717.html
> Sent from the Hadoop core-user mailing list archive at Nabble.com.
>
>

Reply via email to