use of com.orientechnologies.orient.core.metadata.schema.OSchema in project orientdb by orientechnologies.
the class LuceneExportImportTest method init.
@Before
public void init() {
OSchema schema = db.getMetadata().getSchema();
OClass oClass = schema.createClass("City");
oClass.createProperty("name", OType.STRING);
db.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();
ODocument doc = new ODocument("City");
doc.field("name", "Rome");
db.save(doc);
}
use of com.orientechnologies.orient.core.metadata.schema.OSchema in project orientdb by orientechnologies.
the class LuceneFacetTest method init.
@Before
public void init() {
OSchema schema = db.getMetadata().getSchema();
OClass oClass = schema.createClass("Item");
oClass.createProperty("name", OType.STRING);
oClass.createProperty("category", OType.STRING);
db.command(new OCommandSQL("create index Item.name_category on Item (name,category) FULLTEXT ENGINE LUCENE METADATA { 'facetFields' : ['category']}")).execute();
ODocument doc = new ODocument("Item");
doc.field("name", "Pioneer");
doc.field("category", "Electronic/HiFi");
db.save(doc);
doc = new ODocument("Item");
doc.field("name", "Hitachi");
doc.field("category", "Electronic/HiFi");
db.save(doc);
doc = new ODocument("Item");
doc.field("name", "Philips");
doc.field("category", "Electronic/HiFi");
db.save(doc);
doc = new ODocument("Item");
doc.field("name", "HP");
doc.field("category", "Electronic/Computer");
db.save(doc);
db.commit();
}
use of com.orientechnologies.orient.core.metadata.schema.OSchema in project orientdb by orientechnologies.
the class LuceneFreezeReleaseTest method freezeReleaseMisUsageTest.
// With double calling freeze/release
@Test
public void freezeReleaseMisUsageTest() {
ODatabaseDocument db = new ODatabaseDocumentTx("plocal:target/freezeRelease");
db.create();
OSchema schema = db.getMetadata().getSchema();
OClass person = schema.createClass("Person");
person.createProperty("name", OType.STRING);
db.command(new OCommandSQL("create index Person.name on Person (name) FULLTEXT ENGINE LUCENE")).execute();
db.save(new ODocument("Person").field("name", "John"));
try {
Collection results = db.command(new OCommandSQL("select from Person where name lucene 'John'")).execute();
Assert.assertEquals(1, results.size());
db.freeze();
db.freeze();
results = db.command(new OCommandSQL("select from Person where name lucene 'John'")).execute();
Assert.assertEquals(1, results.size());
db.release();
db.release();
db.save(new ODocument("Person").field("name", "John"));
results = db.command(new OCommandSQL("select from Person where name lucene 'John'")).execute();
Assert.assertEquals(2, results.size());
} finally {
db.drop();
}
}
use of com.orientechnologies.orient.core.metadata.schema.OSchema in project orientdb by orientechnologies.
the class LuceneMiscTest method dottedNotationTest.
@Test
public void dottedNotationTest() {
OrientGraphNoTx db = new OrientGraphNoTx("memory:dotted");
try {
OSchema schema = db.getRawGraph().getMetadata().getSchema();
OClass v = schema.getClass("V");
OClass e = schema.getClass("E");
OClass author = schema.createClass("Author");
author.setSuperClass(v);
author.createProperty("name", OType.STRING);
OClass song = schema.createClass("Song");
song.setSuperClass(v);
song.createProperty("title", OType.STRING);
OClass authorOf = schema.createClass("AuthorOf");
authorOf.createProperty("in", OType.LINK, song);
authorOf.setSuperClass(e);
db.command(new OCommandSQL("create index AuthorOf.in on AuthorOf (in) NOTUNIQUE")).execute();
db.command(new OCommandSQL("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE")).execute();
OrientVertex authorVertex = db.addVertex("class:Author", new String[] { "name", "Bob Dylan" });
OrientVertex songVertex = db.addVertex("class:Song", new String[] { "title", "hurricane" });
authorVertex.addEdge("AuthorOf", songVertex);
List<Object> results = db.getRawGraph().command(new OCommandSQL("select from AuthorOf")).execute();
Assert.assertEquals(results.size(), 1);
results = db.getRawGraph().command(new OCommandSQL("select from AuthorOf where in.title lucene 'hurricane'")).execute();
Assert.assertEquals(results.size(), 1);
} finally {
db.drop();
}
}
use of com.orientechnologies.orient.core.metadata.schema.OSchema in project orientdb by orientechnologies.
the class LuceneInsertIntegrityRemoteTest method init.
@Before
public void init() {
OSchema schema = db.getMetadata().getSchema();
OClass oClass = schema.createClass("City");
oClass.createProperty("name", OType.STRING);
db.command(new OCommandSQL("create index City.name on City (name) FULLTEXT ENGINE LUCENE")).execute();
}
Aggregations