Cam Bazz wrote:
Hello Vadim;

I have been looking and experimenting with BFiler. So far, I have been able to insert into BTree, but I have not been able to write to disk. (the initially created file stays at same size).

Best Regards,
-C.B

//
Configuration config = new Configuration(DOMParser.toDocument(Xindice.DEFAULT_CONFIGURATION), false);

That is not valid configuration for the filer.


BTreeFiler btf = new BTreeFiler();
btf.setConfig(config); File file = new File("c:\\"); btf.setLocation(file, "test");
btf.create();
// this works and does indeed inserts to the btree for(int i=0; i<100000; i++)
{
   btf.addValue(new Value("hello"+i), i);
}

// this throws an exception saying page file not open. btf.writeRecord(new Key("key"), new Value("val"));

You have to open it before writing stuff in it. Please see BTreeFilerTest and FilerTestBase test classes, they have everything you need.

Vadim


btf.close();

On 7/5/07, *Vadim Gritsenko* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Cam Bazz wrote:
     > Hello Developers,
     >
     > I have been looking for a solid implementation of a Java BTree on
    disk
     > for the longest time. Could it be possible to use xindices btree
    on disk
     > seperately.
     > If so, where would be a good place to start. I have looked at the
    source
     > code, instantiated a new BTree and added values to it, but I got
    a null
     > pointer exception saying that the file was not opened.

    I don't think you can use BTree class directly. Take a look at
    BTreeFiler - that
    should be better fit. Once you instantiate it, you need to pass in
    configuration
    and open it. Once you are done working with it, it needs to be closed.

    See also org.apache.xindice.core.Collection, there you can see how
    to work with
    Filers.

    PS Have you seen JISP?

    Vadim

    [1] http://www.coyotegulch.com/products/jisp/
    <http://www.coyotegulch.com/products/jisp/>

Reply via email to