This commit is contained in:
rustmailer
2026-05-02 23:53:04 +08:00
parent 2d29a8111b
commit e2fb0ee39e
7 changed files with 17 additions and 11 deletions
+12 -1
View File
@@ -16,7 +16,12 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
use tantivy::IndexWriter;
use tantivy::{schema::Facet, IndexWriter};
use crate::{
error::{code::ErrorCode, BichonResult},
raise_error,
};
pub mod attachment;
pub mod envelope;
@@ -66,3 +71,9 @@ pub fn fatal_commit(writer: &mut IndexWriter) {
}
}
}
pub fn validate_facet(tag: &str) -> BichonResult<()> {
Facet::from_text(tag)
.map(|_| ())
.map_err(|e| raise_error!(format!("{:#?}", e), ErrorCode::InvalidParameter))
}