poboiko created this revision.
poboiko added reviewers: Baloo, bruns, ngraham.
Herald added projects: Frameworks, Baloo.
poboiko requested review of this revision.

REVISION 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.

REPOSITORY
  R293 Baloo

BRANCH
  indexer-consolidate (branched from master)

REVISION DETAIL
  https://phabricator.kde.org/D22392

AFFECTED FILES
  src/file/CMakeLists.txt
  src/file/extractor/CMakeLists.txt
  src/file/extractor/app.cpp
  src/file/extractor/app.h
  src/file/indexer.cpp
  src/file/indexer.h
  src/tools/balooctl/CMakeLists.txt
  src/tools/balooctl/indexer.cpp
  src/tools/balooctl/indexer.h
  src/tools/balooctl/main.cpp

To: poboiko, #baloo, bruns, ngraham
Cc: kde-frameworks-devel, LeGast00n, fbampaloukas, domson, ashaposhnikov, 
michaelh, astippich, spoorun, ngraham, bruns, abrahams

Reply via email to