[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Review Request 128664: Nested tags for Baloo
From:       James Smith <smithjd15 () gmail ! com>
Date:       2016-08-20 22:58:28
Message-ID: 20160820225828.20316.42856 () mimi ! kde ! org
[Download RAW message or body]

--===============6855255487323193452==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit



> On Aug. 19, 2016, 8:51 a.m., Vishesh Handa wrote:
> > This is quite an interesting change.
> > 
> > Could you please also elaborate on how this will change the tags kioslave? I'm \
> > afraid I don't quite follow.

This patch brings Digikam-style tags to Baloo.

Exact tag matches weren't possible with nested tags using the term generator, so tags \
are now indexed without using the term generator. An equal match query is run for the \
KIO slave. Phrase matches are less effective without the term generator, but things \
like query phrase matching for tags with spaces or slashes were broken or partially \
working anyway (no results, the second match was frequently ignored, etc, with \
'baloosearch'.).

The rest of the patch is just minor adjustments to the kio slave to allow nested tags \
to be parsed from the url path and embedding nested tag search results in tag search \
queries.


> On Aug. 19, 2016, 8:51 a.m., Vishesh Handa wrote:
> > src/kioslaves/tags/kio_tags.cpp, line 104
> > <https://git.reviewboard.kde.org/r/128664/diff/1/?file=474469#file474469line104>
> > 
> > QString::compare returns 0 on match or < 0 and > 0 depending on which term is \
> > larger. I don't quite understand what is going on over here.

What it reads like is 'if it starts with but is equal to itself'

I think it's evaluating as integer false. I've replaced this with a separator check \
instead, and eliminated the QStringList creation as well.


> On Aug. 19, 2016, 8:51 a.m., Vishesh Handa wrote:
> > src/kioslaves/tags/kio_tags.cpp, line 396
> > <https://git.reviewboard.kde.org/r/128664/diff/1/?file=474469#file474469line396>
> > 
> > This code is getting hard to follow. Do you think you could write a simple unit \
> > test for just this function? 
> > That way it will be clear what inputs it can accept.
> > 
> > Also I think this function can be made `const`.

Making it a const results in a discards qualifiers warning. It's also really simple \
to not break, and I added some commenting.


> On Aug. 19, 2016, 8:51 a.m., Vishesh Handa wrote:
> > src/lib/searchstore.cpp, line 58
> > <https://git.reviewboard.kde.org/r/128664/diff/1/?file=474470#file474470line58>
> > 
> > I think this line along with the next can now be removed.

It looks like these are still used in fetchPrefix().


- James


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128664/#review98494
-----------------------------------------------------------


On Aug. 18, 2016, 11:56 p.m., James Smith wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128664/
> -----------------------------------------------------------
> 
> (Updated Aug. 18, 2016, 11:56 p.m.)
> 
> 
> Review request for Baloo and Vishesh Handa.
> 
> 
> Bugs: 334615
> http://bugs.kde.org/show_bug.cgi?id=334615
> 
> 
> Repository: baloo
> 
> 
> Description
> -------
> 
> Index and query each tag as a single full term for generating recursed search \
> results. Represent nested tags as recursed items in the Tags:// KIO Slave. 
> 
> Diffs
> -----
> 
> src/file/basicindexingjob.cpp 88bb59a01e5592abb74b1ab345bfc6765d35db57 
> src/kioslaves/tags/kio_tags.cpp de2e6d71945632e23a85f831878b4c431360731c 
> src/lib/searchstore.cpp 060a4fd795ab858eb84526f93f827d09ee85db7c 
> 
> Diff: https://git.reviewboard.kde.org/r/128664/diff/
> 
> 
> Testing
> -------
> 
> Compile, run
> 
> 
> Thanks,
> 
> James Smith
> 
> 


--===============6855255487323193452==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit




<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">  \
<tr>  <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/128664/">https://git.reviewboard.kde.org/r/128664/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On August 19th, 2016, 8:51 a.m. UTC, <b>Vishesh \
Handa</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">This is quite an interesting change.</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">Could you please also elaborate on how this will change the tags kioslave? \
I'm afraid I don't quite follow.</p></pre>  </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This \
patch brings Digikam-style tags to Baloo.</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">Exact tag matches \
weren't possible with nested tags using the term generator, so tags are now indexed \
without using the term generator. An equal match query is run for the KIO slave. \
Phrase matches are less effective without the term generator, but things like query \
phrase matching for tags with spaces or slashes were broken or partially working \
anyway (no results, the second match was frequently ignored, etc, with \
'baloosearch'.).</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">The rest of the patch is just minor \
adjustments to the kio slave to allow nested tags to be parsed from the url path and \
embedding nested tag search results in tag search queries.</p></pre> <br />







<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On August 19th, 2016, 8:51 a.m. UTC, <b>Vishesh \
Handa</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/128664/diff/1/?file=474469#file474469line104" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/kioslaves/tags/kio_tags.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">103</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            \
<span class="k">if</span> <span class="p">(</span><span \
class="n">resultTag</span><span class="p">.</span><span \
class="n">startsWith</span><span class="p">(</span><span class="n">tag</span><span \
class="p">,</span> <span class="n">Qt</span><span class="o">::</span><span \
class="n">CaseInsensitive</span><span class="p">)</span> <span \
class="o">&amp;&amp;</span> <span class="n">resultTag</span><span \
class="p">.</span><span class="n">compare</span><span class="p">(</span><span \
class="n">tag</span><span class="p">,</span> <span class="n">Qt</span><span \
class="o">::</span><span class="n">CaseInsensitive</span><span class="p">))</span> \
<span class="p">{</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">QString::compare returns 0 on match or &lt; 0 and &gt; 0 depending on which \
term is larger. I don't quite understand what is going on over here.</p></pre>  \
</blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">What it reads like is 'if it starts with but is equal to itself'</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">I think it's evaluating as integer false. I've replaced this with a \
separator check instead, and eliminated the QStringList creation as well.</p></pre> \
<br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On August 19th, 2016, 8:51 a.m. UTC, <b>Vishesh \
Handa</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/128664/diff/1/?file=474469#file474469line396" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/kioslaves/tags/kio_tags.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">384</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="n">TagsProtocol</span><span class="o">::</span><span \
class="n">ParseResult</span> <span class="n">TagsProtocol</span><span \
class="o">::</span><span class="n">parseUrl</span><span class="p">(</span><span \
class="k">const</span> <span class="n">QUrl</span><span class="o">&amp;</span> <span \
class="n">url</span><span class="p">,</span> <span class="n">QString</span><span \
class="o">&amp;</span> <span class="n">tag</span><span class="p">,</span> <span \
class="n">QString</span><span class="o">&amp;</span> <span \
class="n">fileUrl</span><span class="p">,</span> <span class="kt">bool</span><span \
class="p">)</span></pre></td>  <th bgcolor="#f0f0f0" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">395</font></th>  <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "><span class="n">TagsProtocol</span><span \
class="o">::</span><span class="n">ParseResult</span> <span \
class="n">TagsProtocol</span><span class="o">::</span><span \
class="n">parseUrl</span><span class="p">(</span><span class="k">const</span> <span \
class="n">QUrl</span><span class="o">&amp;</span> <span class="n">url</span><span \
class="p">,</span> <span class="n">QString</span><span class="o">&amp;</span> <span \
class="n">tag</span><span class="p">,</span> <span class="n">QString</span><span \
class="o">&amp;</span> <span class="n">fileUrl</span><span class="p">,</span> <span \
class="kt">bool</span><span class="p">)</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This \
code is getting hard to follow. Do you think you could write a simple unit test for \
just this function?</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">That way it will be clear what inputs \
it can accept.</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">Also I think this function can be made \
<code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: \
normal;margin: 0;line-height: inherit;">const</code>.</p></pre>  </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">Making it a const results in a discards qualifiers warning. It's also \
really simple to not break, and I added some commenting.</p></pre> <br />

<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On August 19th, 2016, 8:51 a.m. UTC, <b>Vishesh \
Handa</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/128664/diff/1/?file=474470#file474470line58" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/lib/searchstore.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
">PostingIterator* SearchStore::constructQuery(Transaction* tr, const Term&amp; \
term)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">58</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">m_prefixes</span><span class="p">.</span><span class="n">insert</span><span \
class="p">(</span><span class="n">QByteArray</span><span class="p">(</span><span \
class="s">&quot;tag&quot;</span><span class="p">),</span> <span \
class="n">QByteArray</span><span class="p">(</span><span \
class="s">&quot;TA&quot;</span><span class="p">));</span></pre></td>  <th \
bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">58</font></th>  <td bgcolor="#ffffff" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">m_prefixes</span><span class="p">.</span><span class="n">insert</span><span \
class="p">(</span><span class="n">QByteArray</span><span class="p">(</span><span \
class="s">&quot;tag&quot;</span><span class="p">),</span> <span \
class="n">QByteArray</span><span class="p">(</span><span \
class="s">&quot;TA&quot;</span><span class="p">));</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I \
think this line along with the next can now be removed.</p></pre>  </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">It looks like these are still used in fetchPrefix().</p></pre> <br />




<p>- James</p>


<br />
<p>On August 18th, 2016, 11:56 p.m. UTC, James Smith wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for Baloo and Vishesh Handa.</div>
<div>By James Smith.</div>


<p style="color: grey;"><i>Updated Aug. 18, 2016, 11:56 p.m.</i></p>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="http://bugs.kde.org/show_bug.cgi?id=334615">334615</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
baloo
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Index and query each tag as a single full term for \
generating recursed search results. Represent nested tags as recursed items in the \
Tags:// KIO Slave.</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Compile, run</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/file/basicindexingjob.cpp <span style="color: \
grey">(88bb59a01e5592abb74b1ab345bfc6765d35db57)</span></li>

 <li>src/kioslaves/tags/kio_tags.cpp <span style="color: \
grey">(de2e6d71945632e23a85f831878b4c431360731c)</span></li>

 <li>src/lib/searchstore.cpp <span style="color: \
grey">(060a4fd795ab858eb84526f93f827d09ee85db7c)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/128664/diff/" style="margin-left: \
3em;">View Diff</a></p>






  </td>
 </tr>
</table>







  </div>
 </body>
</html>


--===============6855255487323193452==--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic