public static FSA loadFSA(String filename, Query query) throws IOException {
        log(utilsLogger, query, "Loading FSA file from: " + filename);

        if(!new File(filename).exists()) {
            error(utilsLogger, query, "File does not exist : " + filename);
            throw new IOException("File does not exist : " + filename);
        }

        FSA fsa;
        try {
            fsa = new FSA(filename);
        } catch (RuntimeException e) {
            error(utilsLogger, query, "Invalid FSA file");
            throw new IOException("Invalid FSA file");
        }

        if (!fsa.isOk()) {
            error(utilsLogger, query, "Unable to load FSA file from : " + filename);
            throw new IOException("Not able to load FSA file from : " + filename);
        }
        log(utilsLogger, query, "Loaded FSA successfully from file : " + filename);
        return fsa;
    }
Load FSA from file

@param filename FSA dictionary file path
@param query Query object from the searcher, could be null if not available
@return FSA The FSA object for the input file path
container-search/src/main/java/com/yahoo/search/query/rewrite/RewriterUtils.java