我正在使用orientdb并进行索引但我的索引引擎是sBTree我想将其更改为Lucene该做什么?
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();
}
}
}
这是使用SBTree Engine索引的代码如何将索引引擎更改为lucene?请帮忙?
答案 0 :(得分:0)
从图表Api中,您无法更改引擎。
但你可以执行一个命令来创建lucene索引,如下所示:
graph.getRawGraph().command(new OCommandSQL("create index V.name on V (name) FULLTEXT ENGINE LUCENE")).execute();