[balooctl/baloo_file_extractor] Consolidate code that performs actual indexing
Needs ReviewPublic

Authored by poboiko on Jul 11 2019, 8:07 AM.

Details

Reviewers
bruns
ngraham
Group Reviewers
Baloo
Summary

The file contents can be indexed in two ways: either by baloo_file_extractor
after being added to ContentIndexngDB, or by calling balooctl index fname.
The code is duplicated, yet with slight difference, between two places.

This patch introduces and Indexer class, which is shared between extractor
and balooctl, and does all the necessary routine in a unified way.

It also removes checks if the file is already inside ContentIndexingDB from
balooctl index command, and performs indexing even if it is (removing it
from ContentIndexingDB afterwards), which is useful for debugging extractors.

Note that as it unifies behavior of extractor and balooctl, it also now
explicitly forbids indexing of files that are excluded or has invalid
mimetypes via balooctl index; which is useless anyways, because such files
will be removed from the index by IndexCleaner.
Now it prints "failed" message to the user in that case

Test Plan
  • It compiles.
  • balooctl index fname no longer tells useless "the file is already scheduled for indexing" message, reindexing file anyways.

Diff Detail

Repository
R293 Baloo
Branch
indexer-consolidate (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 13836
Build 13854: arc lint + arc unit
poboiko created this revision.Jul 11 2019, 8:07 AM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptJul 11 2019, 8:07 AM
poboiko requested review of this revision.Jul 11 2019, 8:07 AM