<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 17, 2014 at 7:47 AM, Andrey Bondrov <span dir="ltr"><<a href="mailto:andrey.bondrov@rosalab.ru" target="_blank">andrey.bondrov@rosalab.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all.<br>
<br>
I'm trying to port SimpleWelcome application (a launcher for KDE used<br>
in ROSA Desktop by default) from Nepomuk to Baloo. And I have some<br>
questions about Baloo (unfortunately, the only useful documentation on<br>
Baloo seems to be its source code).<br></blockquote><div><br></div><div>Yes. We're severely lacking documentation.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1. Current logic of query types - is it a bug or a feature? I mean it<br>
seems to use AND instead of OR, so nothing is found when I set multiple<br>
types for a query (unless it's "File/Something"). Is there a way to<br>
query types with OR?<br>
<br></blockquote><div><br></div><div>Unfortunately, not with the API exposed.</div><div><br></div><div>The main reason this was done was because each type can be stored in a separate database. Emails are stored in a completely separate place as is the file index. Plus, I was at some point trying to store each major file type in a different database (as a performance boost).</div>
<div><br></div><div>We could probably modify the API to support OR types after a main type.</div><div><br></div><div>So, Main Type: File</div><div>       Secondary Types: Image or Audio or Document</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

2. Is there complete list of terms used by Baloo ("modified" etc)?<br></blockquote><div><br></div><div>Have a look at kfilemetadata/properties.</div><div><br></div><div>The modified property is actually not available. It is stored internally, but its stored in a different way than all of the file properties. Would QFileInfo(url).modified() do?</div>
<div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">3. Is there a way to get sorted results from a query? For example, 10<br>
latest modified images.<br></blockquote><div><br></div><div>Not in a very efficient way. We currently do this for emails, but since we are an index or sorting abilities are much slower.</div><div> </div><div>Anyway, I never landed up adding a sorting API, since it wasn't used. Perhaps we could come up with one? There is a FIXME for sorting in the query.h file. Currently, for emails we try out best to return the most recently modified email first.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">4. Is there a way to query images by size? And get image size from<br>
query results?<br></blockquote><div><br></div><div>Yes, to both.</div><div> </div><div>The API isn't the best, but it can still be improved. </div><div><br></div><div>Searching - You'll have to specify the exact width and height. Comparison operators won't do, cause we do not store them in a special way such that they can be compared. We're just an index right now.</div>
<div><br></div><div>Baloo::Term term("width", 500);</div><div>Baloo::Term term2("height", 200);</div><div><br></div><div>Baloo::Query q(term && term2);</div><div>q.exec();</div><div><br></div><div>
Fetching Image Size -</div><div>Baloo::FileFetchJob job(file);</div><div>job->exec();</div><div>Baloo::File file = job->file();</div><div>file.property(KFileMetaData::Property::Width);</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
5. Is there a way to get types from query results? For example, I<br>
query "File" and then want to sort "Images", "Documents", "Videos" etc.<br>
Of course it can be done with KMimeType::findByUrl() but as this info<br>
is already stored by Baloo, maybe there's a better way?<br></blockquote><div><br></div><div>Perhaps, we should expose something better.</div></div><div><br></div><div>I'm sorry, it seems that almost all of your use cases do not seem to really work out right now. Our main focus was getting searching to work really fast with the KDE tools being used - Dolphin, KRunner, KMail, etc.</div>
<div><br></div>-- <br><span style="color:rgb(192,192,192)">Vishesh Handa</span><br>
</div></div>