Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an implementation of a search term sanitizer for Elasticsearch in Scala?

I'm looking for a method that would sanitize search terms passed to elastic search, i.e. escape all the control characters. Something like what is described in Ruby in this answer. Is there such a thing for Scala?

like image 311
Zoltán Avatar asked Oct 20 '25 21:10

Zoltán


1 Answers

There are provided libs for this that you're probably better off using

import org.apache.lucene.queryparser.classic.QueryParserBase
....    
val escapedQ = QueryParserBase.escape(rawQuery)
like image 128
Oliver Shaw Avatar answered Oct 23 '25 12:10

Oliver Shaw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!