<table><tr><td style="">poboiko created this revision.<br />poboiko added reviewers: Baloo, bruns, ngraham.<br />Herald added projects: Frameworks, Baloo.<br />poboiko requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D22392">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>The file contents can be indexed in two ways: either by <tt style="background: #ebebeb; font-size: 13px;">baloo_file_extractor</tt><br />
after being added to <tt style="background: #ebebeb; font-size: 13px;">ContentIndexngDB</tt>, or by calling <tt style="background: #ebebeb; font-size: 13px;">balooctl index fname</tt>.<br />
The code is duplicated, yet with slight difference, between two places.</p>

<p>This patch introduces and <tt style="background: #ebebeb; font-size: 13px;">Indexer</tt> class, which is shared between extractor<br />
and <tt style="background: #ebebeb; font-size: 13px;">balooctl</tt>, and does all the necessary routine in a unified way.</p>

<p>It also removes checks if the file is already inside <tt style="background: #ebebeb; font-size: 13px;">ContentIndexingDB</tt> from<br />
<tt style="background: #ebebeb; font-size: 13px;">balooctl index</tt> command, and performs indexing even if it is (removing it<br />
from <tt style="background: #ebebeb; font-size: 13px;">ContentIndexingDB</tt> afterwards), which is useful for debugging extractors.</p>

<p>Note that as it unifies behavior of <tt style="background: #ebebeb; font-size: 13px;">extractor</tt> and <tt style="background: #ebebeb; font-size: 13px;">balooctl</tt>, it also now<br />
explicitly forbids indexing of files that are excluded or has invalid<br />
mimetypes via <tt style="background: #ebebeb; font-size: 13px;">balooctl index</tt>; which is useless anyways, because such files<br />
will be removed from the index by <tt style="background: #ebebeb; font-size: 13px;">IndexCleaner</tt>.<br />
Now it prints "failed" message to the user in that case</p></div></div><br /><div><strong>TEST PLAN</strong><div><ul class="remarkup-list">
<li class="remarkup-list-item">It compiles.</li>
<li class="remarkup-list-item"><tt style="background: #ebebeb; font-size: 13px;">balooctl index fname</tt> no longer tells useless "the file is already scheduled for indexing" message, reindexing file anyways.</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R293 Baloo</div></div></div><br /><div><strong>BRANCH</strong><div><div>indexer-consolidate (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D22392">https://phabricator.kde.org/D22392</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/file/CMakeLists.txt<br />
src/file/extractor/CMakeLists.txt<br />
src/file/extractor/app.cpp<br />
src/file/extractor/app.h<br />
src/file/indexer.cpp<br />
src/file/indexer.h<br />
src/tools/balooctl/CMakeLists.txt<br />
src/tools/balooctl/indexer.cpp<br />
src/tools/balooctl/indexer.h<br />
src/tools/balooctl/main.cpp</div></div></div><br /><div><strong>To: </strong>poboiko, Baloo, bruns, ngraham<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, fbampaloukas, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams<br /></div>