Indexing 我正在使用orientdb并做索引,但我的索引引擎是sBTree我想把它改成Lucene怎么办?
我正在使用orientdb并做索引,但我的索引引擎是sBTree我想把它改成Lucene怎么办Indexing 我正在使用orientdb并做索引,但我的索引引擎是sBTree我想把它改成Lucene怎么办?,indexing,lucene,orientdb,full-text-indexing,Indexing,Lucene,Orientdb,Full Text Indexing,我正在使用orientdb并做索引,但我的索引引擎是sBTree我想把它改成Lucene怎么办 public static void main(String[] args) throws IOException { OrientGraph graph = null; try { OrientGraphFactory factory = new OrientGraphFactory("plocal:
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引擎进行索引的代码。如何将索引引擎更改为lucene?请提供帮助?从Graph Api您无法更改引擎 但您可以执行如下命令来创建lucene索引:
graph.getRawGraph().command(new OCommandSQL("create index V.name on V (name) FULLTEXT ENGINE LUCENE")).execute();