[Nepomuk] Review Request 111274: Add positional information to Nepomuk2::Query::Term

Vishesh Handa me at vhanda.in
Mon Jul 29 16:04:17 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111274/#review36754
-----------------------------------------------------------


The main thing that I dislike about this patch is the fact that it adds methods that are very specific to a certain use case in a public API. Do you think you could just make it work with a setUserData(void* ) or something similar? That way anyone who needs to store additional info in a Term can use that.

- Vishesh Handa


On June 27, 2013, 6:45 p.m., Denis Steckelmacher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/111274/
> -----------------------------------------------------------
> 
> (Updated June 27, 2013, 6:45 p.m.)
> 
> 
> Review request for Nepomuk.
> 
> 
> Description
> -------
> 
> This patch adds two fields to Nepomuk2::Query::Term: "position" and "length". By default, they are zero and everything works as before. This change is binary- and source-compatible.
> 
> The in-development Nepomuk query parser (GSoC 2013 project) uses these fields to map parsed terms to the original user query string. By traversing the parse tree (a tree of And, Or and Comparison terms), it is therefore possible to match every term with a piece of input, that can be highlighted accordingly. For instance, each ComparisonTerm can have a different color, its subTerm being rendered using a bold font (like in "sent to *Jimmy*").
> 
> This patch also makes the QuerySerializer serialize the positional information, for debug purposes. This information is not read-back by the deserializer, as the modification would be fairly intrusive, and there is no need to deserialize positional information if the original user query is lost.
> 
> 
> Diffs
> -----
> 
>   libnepomukcore/query/queryserializer.cpp 7ac6131 
>   libnepomukcore/query/term.h 114baa3 
>   libnepomukcore/query/term.cpp cfb41f4 
>   libnepomukcore/query/term_p.h 6d92b48 
> 
> Diff: http://git.reviewboard.kde.org/r/111274/diff/
> 
> 
> Testing
> -------
> 
> The query parser (https://github.com/steckdenis/nepomukqueryparser) is able to store positional information into terms, and this information is valid. The query "files related to mails sent by John, dated of last week" produces the following term tree:
> 
> <and position="0" length="55">
>     <type position="0" length="5" uri="FileDataObject"/>
>     <comparison position="6" length="30" property="relatedTo" comparator="=" inverted="false">
>         <and position="0" length="35">
>             <type position="17" length="5" uri="Message"/>
>             <comparison position="23" length="12" property="messageFrom" comparator=":" inverted="false">
>                 <literal position="31" length="4" datatype="string">
>                     John
>                 </literal>
>             </comparison>
>         </and>
>     </comparison>
>     <and position="46" length="9">
>         <comparison position="46" length="9" property="fileLastModified" comparator=">=" inverted="false">
>             <literal position="46" length="9" datatype="dateTime">
>                 2013-06-16T22:00:00.002Z
>             </literal>
>         </comparison>
>         <comparison position="46" length="9" property="fileLastModified" comparator="<=" inverted="false">
>             <literal position="46" length="9" datatype="dateTime">
>                 2013-06-23T20:00:00.002Z
>             </literal>
>         </comparison>
>     </and>
> </and>
> 
> 
> Thanks,
> 
> Denis Steckelmacher
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/nepomuk/attachments/20130729/75db8059/attachment.html>


More information about the Nepomuk mailing list