use of com.orientechnologies.lucene.analyzer.OLucenePerFieldAnalyzerWrapper in project orientdb by orientechnologies.
the class LuceneVsLuceneTest method init.
@Before
public void init() {
InputStream stream = ClassLoader.getSystemResourceAsStream("testLuceneIndex.sql");
db.command(new OCommandScript("sql", getScriptFromStream(stream))).execute();
OSchema schema = db.getMetadata().getSchema();
OFileUtils.deleteRecursively(getPath().getAbsoluteFile());
try {
Directory dir = getDirectory();
analyzer = new OLucenePerFieldAnalyzerWrapper(new StandardAnalyzer());
analyzer.add("title", new StandardAnalyzer()).add("Song.title", new StandardAnalyzer());
IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
indexWriter = new IndexWriter(dir, iwc);
} catch (IOException e) {
e.printStackTrace();
}
db.command(new OCommandSQL("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE")).execute();
}
Aggregations