JsonSearcher

A web server with a web page which allow to search programming languages from Json file called data.json.

How to start:

Clone the source code from github, update all needed maven dependencies and start main method from JsonSearcherApplication class.

As this code uses Spring Bootstrap it starts Tomcat 8 on home page http://localhost:8080/ out of the box. It also can be modified to get jar/war file to upload it on a remote server.

Main functionality:

  1. Main page contains a search form with dropdowns to change number of results per page and result sorting type
  2. To start searching just start typing in the search input, for example 'Java'.
  3. Main syntax is type all words that you need to find separating them with spaces, for example you can find all languages with author 'James Gosling'
  4. The order of words is irrelevant, however the algorithm first tries to find exact match and only then changes the word order
  5. To exclude some words add '-' in the beggining of such words also separating them with spaces. For example 'Java -JavaScript Gosling James -Script' should return Java language
  6. The search process fires whenever you change search input or click button 'Search' next to the input - it does the same.
  7. Search is non-case sensitive

Class hierarchy:

There are model classes which contain ProgrammingLanguage class, it's comparator PrLangByNameComparer and web UI+model wrapper called UIModel.

There is a repository class MainRepository which makes all needed transorms to get a Set of Programming Languages from data.json file.

In the MainController class is all needed mapping logic for calling search page and ajax queries.

The last two of them are service classes. MainService contains all needed logic to convert and get all needed data that was called by MainController. The SearchEngineService class contains all logic related to search process itself.

In a resources package there are UI files (templates, css, js, fonts), data.json and application.properties

There are also several tests almost for each method in the application.

Used techonologies:

  • Java 8
  • JavaScript
  • Google gson, guava
  • Spring Framework 4
    • Spring Boot
    • Spring Core
    • Spring MVC
    • Spring Web
    • Spring Web Services
  • UI
    • Thymeleaf 2
    • JQuery 2
    • Bootstrap 3
    • CSS3
  • Testing
    • JUnit 4.1
    • Mockito
    • PowerMock