I am using orientdb and doing indexing but my indexing engine is sBTree i want o change it to Lucene what to do?

182 views Asked by At

I am using orientdb and doing indexing but my indexing engine is sBTree i want o change it to Lucene what to do?

 public static void main(String[] args) throws IOException
        {       
            OrientGraph graph = null;

               try {

    OrientGraphFactory factory = new  OrientGraphFactory("plocal:/root/Progs/orientdbcommunity-1.7.10/databases/demotest11").setupPool(1,10);
                   graph=factory.getTx();
                graph.createIndex("number",Vertex.class);
                  graph.createIndex("age",Vertex.class);
                   graph.createIndex("type",Vertex.class);
                   graph.createIndex("location",Vertex.class);
                   graph.createIndex("name",Vertex.class);
                   graph.createIndex("time", Edge.class);
                   graph.createIndex("strength", Edge.class);
                   graph.createIndex("out", Edge.class);
                   BatchGraph bgraph = new BatchGraph(graph, VertexIDType.NUMBER, 700);
                   bgraph.setVertexIdKey("number");
                   bgraph.setLoadingFromScratch(true);                
                   Reader reader = new Reader();
                   List<String> inputList = reader.readFile();
                   InsertinDb insertdbobj = new InsertinDb();
                   long startTime = System.currentTimeMillis();
                   //System.out.println(startTime);
                   insertdbobj.insertinDb(bgraph,inputList);
                   long endTime = System.currentTimeMillis();

                   System.out.println("Time to insert" +(endTime - startTime));
                   graph.commit();
                 //  System.out.println(graph.countVertices());
                   System.out.println("success");
               } catch(OException e) {
                   System.out.println("no success - " + e.getMessage());

                   e.printStackTrace();
               } finally {
                   if(graph != null) {
                       graph.shutdown();
                   }
        }

        }

This is the code for indexing using SBTree Engine how to change the indexing engine to lucene ?Please Help?

1

There are 1 answers

0
wolf4ood On

From Graph Api you cannot change the Engine.

But you could execute a command to create the lucene index like this:

graph.getRawGraph().command(new OCommandSQL("create index V.name on V (name) FULLTEXT ENGINE LUCENE")).execute();