class SearchEngineWrapper implements AutoCloseable {

        private final SearchEngine engine = new SearchEngine();

        private int numResults;

        private SearchEngineWrapper(
                final String full,
                final String def,
                final String symbol,
                final String path,
                final String hist,
                final String type
        ) {
            engine.setFreetext(full);
            engine.setDefinition(def);
            engine.setSymbol(symbol);
            engine.setFile(path);
            engine.setHistory(hist);
            engine.setType(type);
        }

        public List<Hit> search(
                final HttpServletRequest req,
                final List<String> projects,
                final int startDocIndex,
                final int maxResults
        ) {<FILL_FUNCTION_BODY>}

        private boolean isValid() {
            return engine.isValidQuery();
        }

        private Query getQuery() {
            return engine.getQueryObject();
        }

        @Override
        public void close() {
            engine.destroy();
        }
    }

            Set<Project> allProjects = PageConfig.get(req).getProjectHelper().getAllProjects();
            if (projects == null || projects.isEmpty()) {
                numResults = engine.search(new ArrayList<>(allProjects));
            } else {
                numResults = engine.search(allProjects.stream()
                        .filter(p -> projects.contains(p.getName()))
                        .collect(Collectors.toList()));
            }

            if (startDocIndex > numResults) {
                return Collections.emptyList();
            }

            int resultSize = numResults - startDocIndex;
            if (resultSize > maxResults) {
                resultSize = maxResults;
            }

            List<Hit> results = new ArrayList<>();
            engine.results(startDocIndex, startDocIndex + resultSize, results);

            return results;
        
<no_super_class>