# org.das2.util.BooleanSearch

Small Boolean full-text search parser. Requires Java 8 or later.

 <p>Operators (case-insensitive): NOT, AND, OR, in descending precedence.
 Adjacent terms imply AND. Parentheses group expressions; double quotes
 match literal phrases. A minus sign at the start of a term means NOT.
 Searches are case-insensitive substring matches, not whole-word matches.

 <p>Example:  BooleanSearch.compile("(rbsp OR themis) AND density")

***
<a name="compile-java.lang.String"></a>
# compile
compile( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> query ) &rarr; <a href='https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html'>java.util.function.Predicate</a>

Compiles a query once for use against many strings.

### Parameters:
query - a String

### Returns:
java.util.function.Predicate


<a href="https://github.com/autoplot/dev/search?q=compile&unscoped_q=compile">[search for examples]</a>
<a href="https://github.com/autoplot/documentation/blob/master/javadoc/index-all.md">[return to index]</a>

***
<a name="compileLenient-java.lang.String"></a>
# compileLenient
compileLenient( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> query ) &rarr; <a href='https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html'>java.util.function.Predicate</a>

Compiles a partially typed query for interactive search fields.
 Incomplete trailing operators and empty opening groups are discarded;
 unmatched opening parentheses are closed automatically. An unfinished
 quoted phrase is treated as a phrase extending to the end of the query.
 Other syntax errors are still reported.

### Parameters:
query - a String

### Returns:
java.util.function.Predicate


<a href="https://github.com/autoplot/dev/search?q=compileLenient&unscoped_q=compileLenient">[search for examples]</a>
<a href="https://github.com/autoplot/documentation/blob/master/javadoc/index-all.md">[return to index]</a>

***
<a name="matches-java.lang.String-java.lang.String"></a>
# matches
matches( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> query, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> text ) &rarr; boolean

Convenience method for one-off matches.

### Parameters:
query - a String
<br>text - a String

### Returns:
boolean


<a href="https://github.com/autoplot/dev/search?q=matches&unscoped_q=matches">[search for examples]</a>
<a href="https://github.com/autoplot/documentation/blob/master/javadoc/index-all.md">[return to index]</a>

