Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #12 from mads379/include_lucene

Added Lucene to the project
  • Loading branch information...
commit 7d152c44768a3c623b5b835dde3efbfdabb9e772 2 parents 509fa90 + 902a329
@dotta dotta authored
View
2  org.scala.tools.eclipse.search.tests/.classpath
@@ -4,5 +4,7 @@
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="lib" path="/org.scala.tools.eclipse.search/target/lib/lucene-analyzers-common-4.1.0.jar"/>
+ <classpathentry kind="lib" path="/org.scala.tools.eclipse.search/target/lib/lucene-core-4.1.0.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
View
3  org.scala.tools.eclipse.search.tests/pom.xml
@@ -16,10 +16,11 @@
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<testSuite>${project.artifactId}</testSuite>
- <testClass>org.scala.tools.eclipse.search.SomeInterestingCodeTest</testClass>
+ <testClass>org.scala.tools.eclipse.search.TestsSuite</testClass>
</configuration>
</plugin>
</plugins>
</build>
+
</project>
View
41 org.scala.tools.eclipse.search.tests/src/org/scala/tools/eclipse/search/LuceneIntegrationTest.scala
@@ -0,0 +1,41 @@
+package org.scala.tools.eclipse.search
+
+import java.io.File
+
+import org.apache.lucene.analysis.core.SimpleAnalyzer
+import org.apache.lucene.document.Document
+import org.apache.lucene.document.Field
+import org.apache.lucene.index.DirectoryReader
+import org.apache.lucene.index.IndexWriter
+import org.apache.lucene.index.IndexWriterConfig
+import org.apache.lucene.store.FSDirectory
+import org.apache.lucene.util.Version
+import org.junit.Assert._
+import org.junit.Test
+
+object LuceneIntegrationTest {
+ val INDEX_DIR = new File(path("target","lucene-test-index"))
+
+ private def path(strings: String*) =
+ strings.mkString(File.separator)
+}
+
+class LuceneIntegrationTest {
+
+ import LuceneIntegrationTest._
+
+ @Test def integration() {
+ val dir = FSDirectory.open(INDEX_DIR)
+ val analyzer = new SimpleAnalyzer(Version.LUCENE_41)
+ val config = new IndexWriterConfig(Version.LUCENE_41, analyzer);
+ val writer = new IndexWriter(dir, config)
+ val doc = new Document
+ doc.add(new Field("test", "it works!", Field.Store.YES, Field.Index.NOT_ANALYZED))
+ writer.addDocument(doc)
+ writer.close()
+ val reader = DirectoryReader.open(dir)
+ val d = reader.document(0)
+
+ assertEquals("Should be able to store and read a document", doc.get("test"), d.get("test"))
+ }
+}
View
11 org.scala.tools.eclipse.search.tests/src/org/scala/tools/eclipse/search/TestsSuite.scala
@@ -0,0 +1,11 @@
+package org.scala.tools.eclipse.search
+
+import org.junit.runner.RunWith
+import org.junit.runners.Suite
+
+
+@RunWith(classOf[Suite])
+@Suite.SuiteClasses(Array(
+ classOf[LuceneIntegrationTest]
+))
+class TestsSuite {}
View
2  org.scala.tools.eclipse.search/.classpath
@@ -4,5 +4,7 @@
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="target/lib/lucene-analyzers-common-4.1.0.jar"/>
+ <classpathentry kind="lib" path="target/lib/lucene-core-4.1.0.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
View
4 org.scala.tools.eclipse.search/META-INF/MANIFEST.MF
@@ -30,4 +30,6 @@ Import-Package:
scala.tools.eclipse;apply-aspects:=false,
scala.tools.eclipse.contribution.weaving.jdt.ui.javaeditor.formatter;apply-aspects:=false
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ClassPath: .
+Bundle-ClassPath: .,
+ target/lib/lucene-core-4.1.0.jar,
+ target/lib/lucene-analyzers-common-4.1.0.jar
View
4 org.scala.tools.eclipse.search/build.properties
@@ -1,7 +1,7 @@
source.. = src/
output.. = target/classes/
bin.includes = META-INF/,\
- icons/,\
.,\
plugin.xml,\
- plugin.properties
+ plugin.properties,\
+ target/lib/\
View
48 org.scala.tools.eclipse.search/pom.xml
@@ -10,4 +10,52 @@
<artifactId>org.scala.tools.eclipse.search</artifactId>
<packaging>eclipse-plugin</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ <version>4.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-analyzers-common</artifactId>
+ <version>4.1.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <!-- copy the jar dependencies -->
+ <execution>
+ <id>copy</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ <version>4.1.0</version>
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-analyzers-common</artifactId>
+ <version>4.1.0</version>
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Please sign in to comment.
Something went wrong with that request. Please try again.