@Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html");
        response.setStatus(HttpServletResponse.SC_OK);

        Map<String, String[]> params = request.getParameterMap();
        if (!params.containsKey("id")) {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().println("param id not found");
            return;
        }
        if (!params.containsKey("word")) {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().println("param word not found");
            return;
        }


        long id = 0;
        try {
            id = Long.parseLong(params.get("id")[0]);
        } catch (Exception e) {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().println("id not type long");
        }
        int editDistance = 1;
        if (params.containsKey("edit_distance")) {
            try {
                int value = Integer.parseInt(params.get("edit_distance")[0]);
                editDistance = value > 0 ? value : 1;
            } catch (Exception e) {

            }
        }
        if (spellCheckMap.containsKey(id)) {
            List<String> results = spellCheckMap.get(id).search(params.get("word")[0], editDistance);
            try {
                response.getWriter().println(new Response(results).toString());
            } catch (JSONException e) {
                e.printStackTrace();
                response.getWriter().println("Something is wrong with the service right now...");
            }
        } else {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().println("id not found");
        }

    }