Updating DB using Java Code

Saturday, 2 February 2013 · 2 messages
JB
John Best2 Feb 2013 07:52 #
Dear BaseX Team, I am using BaseX to store XML. This XML DB will get updated regularly through net. After updating, I will need to create Full-Text, Text and Attribute Indexes. Below is the Java Code I am using -
str = "http://www.abcd.com/updates/data.xml";
qry = "for $c in doc('"+ str +"')//Doc return insert node $c into
doc('myDoc')/Docs";

try
{
    query(qry);
}
catch(Exception e)
{
    System.out.println(e);
}

try
{
    System.out.println("Opening the Database.....");
        new Open("myDocs").execute(CONTEXT);
        System.out.println("Database opened.....");
        System.out.println("Indexing started.....");
        new CreateIndex("FULLTEXT").execute(CONTEXT);
        new CreateIndex("TEXT").execute(CONTEXT);
        new CreateIndex("ATTRIBUTE").execute(CONTEXT);
        System.out.println("Indexing done.....");
}
catch(Exception e)
{
    System.out.println("Exception while creating Index " + e);
}
In the above code, I am doing 2 things- first is updating the "myDocs" database and after that Indexing... The first part, updation is not working. I tried to execute the query directly in BaseX, but its not working there too. *But when I open the said DB and run the same query, its updating the DB*.. !!
-- Have a nice day JBest
LK
Lukas Kircher2 Feb 2013 10:05 #
Hi John, just a quick note: As you execute the update query first, I assume you've already created the indexes before. To re-validate the indexes it should be enough to call [db:optimize] on your 'myDoc' database. Cheers, Lukas [db:optimize] http://docs.basex.org/wiki/Database_Module#db:optimize
Quoted text · John Best · 65 lines
On Sat, Feb 2, 2013 at 7:52 AM, John Best <johnbest5673 at gmail.com> wrote: > Dear BaseX Team, > > > I am using BaseX to store XML. This XML DB will get updated regularly > through net. > After updating, I will need to create Full-Text, Text and Attribute > Indexes. > > Below is the Java Code I am using - > > str = "http://www.abcd.com/updates/data.xml"; > qry = "for $c in doc('"+ str +"')//Doc return insert node $c into > doc('myDoc')/Docs"; > > try > { > query(qry); > } > catch(Exception e) > { > System.out.println(e); > } > > try > { > System.out.println("Opening the Database....."); > new Open("myDocs").execute(CONTEXT); > System.out.println("Database opened....."); > System.out.println("Indexing started....."); > new CreateIndex("FULLTEXT").execute(CONTEXT); > new CreateIndex("TEXT").execute(CONTEXT); > new CreateIndex("ATTRIBUTE").execute(CONTEXT); > System.out.println("Indexing done....."); > } > catch(Exception e) > { > System.out.println("Exception while creating Index " + e); > } > > > In the above code, I am doing 2 things- first is updating the "myDocs" > database and after that Indexing... > The first part, updation is not working. > > I tried to execute the query directly in BaseX, but its not working there > too. *But when I open the said DB and run the > same query, its updating the DB*.. !! > > > > > > -- > Have a nice day > JBest > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >

⚡Generated with XQuery