docs icon indicating copy to clipboard operation
docs copied to clipboard

Search suggestion is enabled even without full search terms

Open archiloque opened this issue 2 years ago • 2 comments

In com.sismics.docs.core.util.indexing.LuceneIndexingHandler#findByCriteria I found this code:

        if (!Strings.isNullOrEmpty(criteria.getSimpleSearch()) || !Strings.isNullOrEmpty(criteria.getFullSearch())) {
            // …
            suggestSearchTerms(criteria.getFullSearch(), suggestionList);
        }

It means that if criteria.getSimpleSearch() is filled and criteria.getFullSearch() is null, suggestSearchTerms is called with a null parameter. It feels wrong => in this case should the suggestion search be skipped ?

archiloque avatar Sep 26 '23 08:09 archiloque

You are right, suggestSearchTerms should only be called with a non null "search" parameter, otherwise it will throw NPE inside. Could you do a PR please?

jendib avatar Oct 08 '23 20:10 jendib

Thanks, I'll do a PR after https://github.com/sismics/docs/pull/722 is merged to avoid any conflict risk

archiloque avatar Oct 09 '23 08:10 archiloque