class LuceneAspspRepository implements AspspRepository {

    @Override
    public List<Aspsp> findLike(Aspsp aspsp, String after, int size) {
        if (logger.isDebugEnabled()) {
            logger.debug(buildFindLikeLoggingMessage(aspsp));
        }
        BooleanQuery.Builder queryBuilder = new BooleanQuery.Builder();
        if (aspsp.getName() != null) {
            queryBuilder.add(buildQueryWithPriority(getNameFuzzyQuery(aspsp.getName()), LOW_PRIORITY), BooleanClause.Occur.SHOULD);
            queryBuilder.add(buildQueryWithPriority(getNameRegexpQuery(aspsp.getName()), LOW_PRIORITY), BooleanClause.Occur.SHOULD);
        }
        if (aspsp.getBic() != null && aspsp.getBankCode() != null) {
            String bic = aspsp.getBic();
            String bankCode = aspsp.getBankCode();

            queryBuilder.add(buildQueryWithPriority(getBicAndBankCodeQuery(bic, bankCode), HIGH_PRIORITY), BooleanClause.Occur.SHOULD);
            queryBuilder.add(buildQueryWithPriority(getBicAndEmptyBankCodeQuery(bic), MEDIUM_PRIORITY), BooleanClause.Occur.SHOULD);
            queryBuilder.add(buildQueryWithPriority(getEmptyBicAndBankCodeQuery(bankCode), LOW_PRIORITY), BooleanClause.Occur.SHOULD);
        } else {
            if (aspsp.getBic() != null) {
                queryBuilder.add(getBicQuery(aspsp.getBic()), BooleanClause.Occur.SHOULD);
            }
            if (aspsp.getBankCode() != null) {
                queryBuilder.add(getBankCodeQuery(aspsp.getBankCode()), BooleanClause.Occur.SHOULD);
            }
        }

        return find(queryBuilder.build(), after, size);
    }

    public  LuceneAspspRepository(Directory directory);

}