Class LuceneQueryUtil


  • public class LuceneQueryUtil
    extends Object
    Utility class to help with creating queries. Also, useful for writing tests.
    Since:
    6.16.0
    • Constructor Detail

      • LuceneQueryUtil

        public LuceneQueryUtil()
    • Method Detail

      • tokenize

        public static Collection<String> tokenize​(org.apache.lucene.analysis.Analyzer analyzer,
                                                  String field,
                                                  String text)
        NOTE:The ordering of tokens in the collection, is guaranteed to be in the order the text is processed. Duplicated tokens are allowed.

        e.g. "the quick brown fox the" guaranteed to be in the order {"the", "quick", "brown", "fox", "the"} if whitespace analysis is done.

        For some use cases, it may also be useful to convert into an ordered set implementation, to avoid duplicates.

      • safeEscape

        public static String safeEscape​(String query)