Search / indexing on small binary fields in SOLR

2019-08-09 05:37发布

问题:

Need to index small binary strings with SOLR but failed to do so. Actually I'm trying to search on hashes like SHA-1, MD5 and things like UUID.

Have binary field intended to be indexed.

<field name="fi" type="binary" indexed="true" stored="true" required="false" multiValued="false" />

Have binary type definition.

<fieldtype name="binary" class="solr.BinaryField"/>

Why any try to select on this field even with fi:* request cannot find anything? Any alternative to my approach?

回答1:

if your data is just SHA1 etc, I think you can perfectly make this work with a StrField. Of course if you need prefix searches be sure to properly analyze it with solr.EdgeNGramTokenizerFactory.

Regarding the binary field you are using, I never had to use it myself, but what apparently does is encode in base64 whatver you send, and index it then, so you can reallly send binary data (like an .exe file).