-
Notifications
You must be signed in to change notification settings - Fork 2
Usage and Configuration
GaeDirectory directory = new GaeDirectory();//create a default index
IndexWriterConfig config = GaeLuceneUtil.getIndexWriterConfig(analyzer);//get configuration if you are using a LAE version less than 3.x.x add LUCENE_VERSION as parameter
IndexWriter w = new IndexWriter(directory, config);//get the writer
/* now use Apache Lucene like you're used to */
In order to manage multiple index instances simply create multiple GaeDirectory instances with different names:
GaeDirectory directory = new GaeDirectory("anotherIndexName");
A complete example with source code lucene-appengine-examples
Add into your WEB-INF/web.xml the objectify servlet (see objectify documentation for details and alternatives):
<web-app …>
…
<filter>
<filter-name>ObjectifyFilter</filter-name>
<filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ObjectifyFilter</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
…
</web-app>
Add into your WEB-INF/appengine-web.xml:
<appengine-web-app>
....
<class-loader-config>
<priority-specifier filename="luceneappengine-[LAE Version].jar"/>
</class-loader-config>
.....
<system-properties>
...
<property name="os.version" value="1.0.GAE whatever" />
<property name="os.arch" value="GAE whatever" />
</system-properties>
</appengine-web-app>
WARNING: If you are using a SNAPSHOT version of LAE using Maven, you must add the specific jar name of the snapshot, you can see the specific jar name typing on command line 'mvn clean package && ls -lR target/ | grep lucene-appengine'
If you are using maven to build/deploy google app engine war add this snippet to import the lucene directory (if you need a specific version remember to respect compatibility matrix)
<dependencies>
<!-- Declare dependencies in this order -->
<dependency>
<groupId>com.googlecode.luceneappengine</groupId>
<artifactId>luceneappengine</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>5.5.0</version>
</dependency>
....
</dependencies>
For a complete example and source-code see LAE Examples project
- Configuration
- Compatibility matrix
- Technology Stack
- Known Issues
- DeployIssueRamUsageEstimator
- Downloads
- Support Us
- Blog
- Author Blog
- External links
- Live Demo Application
- Live Demo Sources
- LAE API
- Google App Engine Docs
- Maven Site (old)
- Groups
- Users Group