IFullTextFilter.java

/*
 * Copyright 2026 Global Crop Diversity Trust
 * Licensed under the Apache License, Version 2.0
 * See LICENSE file in project root folder or http://www.apache.org/licenses/LICENSE-2.0
 */

package org.gringlobal.service.filter;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.StringUtils;

/**
 * IFullTextFilter is used to mark filters that use full-text search with ES
 */
public interface IFullTextFilter {

	/**
	 * Gets the text.
	 *
	 * @return the text
	 */
	String get_text();

	/**
	 * Does the filter require full-text search?
	 *
	 * @return true if {@link #get_text()} is non-blank
	 */
	@JsonIgnore
	default boolean isFulltextQuery() {
		return StringUtils.isNotBlank(get_text());
	}
}