Search in sources :

Example 51 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL in project orientdb by orientechnologies.

the class LuceneQueryErrorTest method init.

@Before
public void init() {
    InputStream stream = ClassLoader.getSystemResourceAsStream("testLuceneIndex.sql");
    db.command(new OCommandScript("sql", getScriptFromStream(stream))).execute();
    db.command(new OCommandSQL("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE")).execute();
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) InputStream(java.io.InputStream) OCommandScript(com.orientechnologies.orient.core.command.script.OCommandScript) Before(org.junit.Before)

Example 52 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL in project orientdb by orientechnologies.

the class LuceneReuseTest method shouldUseTheRightIndex.

@Test
public void shouldUseTheRightIndex() {
    OSchemaProxy schema = db.getMetadata().getSchema();
    OClass cls = schema.createClass("Reuse");
    cls.createProperty("name", OType.STRING);
    cls.createProperty("date", OType.DATETIME);
    cls.createProperty("surname", OType.STRING);
    cls.createProperty("age", OType.LONG);
    db.command(new OCommandSQL("create index Reuse.composite on Reuse (name,surname,date,age) UNIQUE")).execute();
    db.command(new OCommandSQL("create index Reuse.surname on Reuse (surname) FULLTEXT ENGINE LUCENE")).execute();
    for (int i = 0; i < 10; i++) {
        db.save(new ODocument("Reuse").field("name", "John").field("date", new Date()).field("surname", "Reese").field("age", i));
    }
    Collection<ODocument> results = db.command(new OCommandSQL("SELECT FROM Reuse WHERE name='John' and surname LUCENE 'Reese'")).execute();
    Assert.assertEquals(10, results.size());
    results = db.command(new OCommandSQL("SELECT FROM Reuse WHERE surname LUCENE 'Reese' and name='John'")).execute();
    Assert.assertEquals(10, results.size());
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) OSchemaProxy(com.orientechnologies.orient.core.metadata.schema.OSchemaProxy) OClass(com.orientechnologies.orient.core.metadata.schema.OClass) Date(java.util.Date) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) Test(org.junit.Test)

Example 53 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL in project orientdb by orientechnologies.

the class LuceneSingleFieldEmbeddedTest method init.

@Before
public void init() {
    InputStream stream = ClassLoader.getSystemResourceAsStream("testLuceneIndex.sql");
    db.command(new OCommandScript("sql", getScriptFromStream(stream))).execute();
    db.command(new OCommandSQL("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE")).execute();
    db.command(new OCommandSQL("create index Song.author on Song (author) FULLTEXT ENGINE LUCENE")).execute();
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) InputStream(java.io.InputStream) OCommandScript(com.orientechnologies.orient.core.command.script.OCommandScript) Before(org.junit.Before)

Example 54 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL in project orientdb by orientechnologies.

the class LuceneSkipLimitTest method init.

@Before
public void init() {
    InputStream stream = ClassLoader.getSystemResourceAsStream("testLuceneIndex.sql");
    db.command(new OCommandScript("sql", getScriptFromStream(stream))).execute();
    db.command(new OCommandSQL("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE")).execute();
    db.command(new OCommandSQL("create index Song.author on Song (author) FULLTEXT ENGINE LUCENE")).execute();
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) InputStream(java.io.InputStream) OCommandScript(com.orientechnologies.orient.core.command.script.OCommandScript) Before(org.junit.Before)

Example 55 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL 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();
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) OSchema(com.orientechnologies.orient.core.metadata.schema.OSchema) OClass(com.orientechnologies.orient.core.metadata.schema.OClass) Before(org.junit.Before)

Aggregations

OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)621 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)422 Test (org.junit.Test)97 Test (org.testng.annotations.Test)93 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)83 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)79 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)78 ORID (com.orientechnologies.orient.core.id.ORID)64 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)61 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)54 Set (java.util.Set)53 HashMap (java.util.HashMap)45 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)42 OrientVertex (com.tinkerpop.blueprints.impls.orient.OrientVertex)41 List (java.util.List)25 Before (org.junit.Before)24 OStorage (com.orientechnologies.orient.core.storage.OStorage)23 OrientGraphNoTx (com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx)23 ORecordId (com.orientechnologies.orient.core.id.ORecordId)21 Vertex (com.tinkerpop.blueprints.Vertex)19