Skip to content

Commit

Permalink
added version to maven-compiler plugin;
Browse files Browse the repository at this point in the history
added lyrics field to songs sql file used in test
  • Loading branch information
robfrank committed Sep 3, 2015
1 parent 0e53717 commit 67ce38c
Show file tree
Hide file tree
Showing 4 changed files with 616 additions and 588 deletions.
9 changes: 4 additions & 5 deletions pom.xml
Expand Up @@ -27,9 +27,7 @@

<properties>
<surefire.version>2.17</surefire.version>
<jdkVersion>1.6</jdkVersion>
<javac.src.version>1.6</javac.src.version>
<javac.target.version>1.6</javac.target.version>

<orientdb.version>${version}</orientdb.version>
<lucene.version>4.7.0</lucene.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -162,9 +160,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>2.3.2</version>
<configuration>

<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>

Expand Down
Expand Up @@ -34,6 +34,6 @@ public void init() {

@AfterClass
public void deInit() {
deInitDB();
}
deInitDB();
}
}
Expand Up @@ -56,20 +56,26 @@ public void init() {
song.setSuperClass(v);
song.createProperty("title", OType.STRING);
song.createProperty("author", OType.STRING);
song.createProperty("lyrics", OType.STRING);

databaseDocumentTx.command(new OCommandSQL("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE")).execute();
databaseDocumentTx.command(new OCommandSQL("create index Song.author on Song (author) NOTUNIQUE")).execute();

databaseDocumentTx.command(new OCommandSQL("create index Song.composite on Song (title,lyrics) FULLTEXT ENGINE LUCENE")).execute();

// databaseDocumentTx.command(new OCommandSQL("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE")).execute();

InputStream stream = ClassLoader.getSystemResourceAsStream("testLuceneIndex.sql");

databaseDocumentTx.command(new OCommandScript("sql", getScriptFromStream(stream))).execute();

}

@Test
public void testMixQuery() {


List<ODocument> docs = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(
"select * from Song where author = 'Hornsby' and [title] LUCENE \"(title:mountain)\" "));
"select * from Song where author = 'Hornsby' and [title] LUCENE \"(title:mountain)\" "));

Assert.assertEquals(docs.size(), 1);

Expand All @@ -88,6 +94,29 @@ public void testMixQuery() {

}

@Test
public void testMixCompositeQuery() {

List<ODocument> docs = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(
"select * from Song where author = 'Hornsby' and [title,lyrics] LUCENE \"(title:mountain)\" "));

Assert.assertEquals(docs.size(), 1);

docs = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(
"select * from Song where author = 'Hornsby' and lyrics LUCENE \"(lyrics:happy)\" "));

Assert.assertEquals(docs.size(), 1);

// docs = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(
// "select * from Song where author = 'Hornsby' and [title] LUCENE \"(title:ballad)\" "));
// Assert.assertEquals(docs.size(), 0);
//
// docs = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(
// "select * from Song where author = 'Hornsby' and title LUCENE \"(title:ballad)\" "));
// Assert.assertEquals(docs.size(), 0);

}

protected String getScriptFromStream(InputStream in) {
String script = "";
try {
Expand Down

0 comments on commit 67ce38c

Please sign in to comment.