Skip to content

evgeniyBog/Your.MD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dictionary Search

##Comments Search for words in the query is done using Elasticsearch Percolator. This is a great tool to percolate message through queries, and return those that have matched. This allows costumise queries, add filters and the most important - scale this solution.

##Pre-requirements:

  1. Java 8
  2. Elasticsearch 1.7.5

##Technologies used: Java, Spring boot, Gradle, Elasticsearch, Ehcache, Logback

##Running application and tests

  1. Start Elasticsearch 1.7.5 by running [ELASTIC_HOME]/bin/elasticsearch
  2. Run application
    • Execute from command line: 'gradlew bootRun'
    • Package and run: 'gradlew build && java -jar build/libs/your.md-0.0.1.jar'
  3. Query dictionary using any browser passing url:

##Implementation details: Indexing appears once on first application startup (if ElasticSearch is running). If index exists, and dictionary has the same number of words no indexing would occure. Words are indexed as percolator queries.

Dictionary is cached from file into memory HashMap, and used by service to: a) Add words into Elasticsearch index b) Find word by id from index.

Each query from user is cached using Ehcache. So no index hit would occure in case of repeating query.

Search for query occures on the Elasticsearch node using Percolate API

Note: Elasticsearch was started AFTER service start-up, indexing will occure on first search

Note: Sense tool could be installed as plugin for Chrome to work with index. Useful command:

  • Searching
GET yourmd/words/_percolate
{
    "doc" : {
        "message" : "What is Hypertension?"
    }
}
  • Return index statistics
GET yourmd/_stats
  • Delete index
DELETE yourmd

About

Coding assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages