B4J Library [server] jElasticsearch - Search and Text Analytics

Discussion in 'B4J Libraries & Classes' started by Erel, Nov 22, 2016.

  1. Erel

    Erel Administrator Staff Member Licensed User

    The battle between a directory:


    And search:


    Has been won long ago.

    Providing a search feature is important for good user experience.
    Unfortunately it is not a simple task.
    Elasticsearch is a search framework built over Lucene. Lucene is an open source project for text search. (Note that the forum search and similar threads features are also powered by Lucene.)

    Elasticsearch simplifies many tasks required to build a search engine and adds many features over Lucene.
    Elasticsearch is quite similar to MongoDB. It is also a document store. However the use cases and focus are different. Elasticsearch stores the data in a Lucene index and offers powerful text features.

    jElasticsearch is a wrapper for the REST client provided by Elasticsearch.
    It is expected to be used from a server solution.

    The attached example implements a simple search engine that builds an index from B4X libraries files and allows searching them.


    Note that it uses the new Background Worker feature of jServer library: https://www.b4x.com/android/forum/threads/73269/#content
    It depends on jServer v2.70+.

    The worker checks for updates every 10 minutes.

    Building a good search engine is not simple. It requires learning the main search concepts and the many available options.
    I recommend starting with the guide: https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
    And reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html

    Elasticsearch can be downloaded here: https://www.elastic.co/downloads/elasticsearch
    You need to start Elasticsearch.bat and then run the example.

    jElasticsearch depends on several additional jars:

    Copy them to the additional libraries folder.

    Attached Files:

    paragkini, adjie, Mashiane and 10 others like this.
  2. hibrid0

    hibrid0 Active Member Licensed User

    Hi, I have a server with 3 tb of documents.
    I want to make a tool on b4j to search.
    Maybe this will work for search on local disk?
  3. Erel

    Erel Administrator Staff Member Licensed User

    Yes, you can use Elasticsearch to search the documents. Indexing 3 tb of data is not a simple task. You will most probably need to use a cluster solution.

    I recommend you to start with a smaller set of documents or only index part of the documents (titles and abstracts).
    hibrid0 likes this.