Categories
Dictionnary
Download
Project Details
Changes Log
FAQ
License

jElasticlunr is a Java full text-search library. It is a Java port of the elasticlunr Javascript library.

Usage

Main Article: Usage

A very simple search index can be created using the following code:

      Index index = ElasticLunr.createIndex();
      index.addField("title");
      index.addField("body");

Adding documents to the index is as simple as:

      JSONObject doc1 = new JSONObject();
      doc1.put("id", 1);
      doc1.put("title", "Oracle released its latest database Oracle 12g");
      doc1.put("body", "Yestaday Oracle has released its new database Oracle 12g.");
      ...
      index.addDoc(doc1);

Searching is simple:

      List<JSONObject> results = index.search("Oracle database");

      JSONObject result = results.get(0);
      String ref = result.getString("ref");

Format compatibility

Main Article: Format compatibility

The JSON format of the index is compatible with the format used in the elasticlunr Javascript library, so for example you can save the index as JSON in Java and load the same index in Javascript.

FAQ

See FAQ.


Categories: general

Developers

Join this project:

To join this project, please contact the project administrators of this project, as shown on the project summary page.

Get the source code:

Source code for this project is available as downloads or through the git repository used by the project, as accessible from the project develop page.

Copyright 2017 Wei Song. Copyright 2018 Herve Girod. All Rights Reserved. Documentation and source under the MIT licence