Fix file name could not be searched if the file was not a text file when using the Bleve indexer (#33959)

Close #33828

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
pull/33947/head^2
charles 4 days ago committed by GitHub
parent 279473f467
commit b956cee06f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -191,7 +191,8 @@ func (b *Indexer) addUpdate(ctx context.Context, batchWriter git.WriteCloserErro
return err
} else if !typesniffer.DetectContentType(fileContents).IsText() {
// FIXME: UTF-16 files will probably fail here
return nil
// Even if the file is not recognized as a "text file", we could still put its name into the indexers to make the filename become searchable, while leave the content to empty.
fileContents = nil
}
if _, err = batchReader.Discard(1); err != nil {

Loading…
Cancel
Save