Re: [Tracker] Searching for Filnames with underscore



On 13/07/11 07:25, Adrien Bustany wrote:
On Tue, 12 Jul 2011 22:32:14 +0200, Aleksander Morgado wrote:
Hi hi Thomas,


thanks for the info. So this means I have to use space as separator
in file names? Any possiblities to change that? I can understand it
from a technical point of you but why is this restriction opposed on
the user. There are enough arguments to not use spaces in filenames?

Kind of confused ;-)


The word breaking algorithm is not something applied only to filenames,
it is applied to all text parsed for FTS searching, and the same rules
apply to all the text, we don't have specific rules just for filenames.
So, if you want to really look for files with FTS using as search word
part of the filename, not the start of it, you'll need to use something
else as word separator (whitespace will do it; and also single dot,
which will always be forced as word separator, even if Unicode word
breaking rules don't say so).

My suggestion is to avoid thinking that FTS is just to look for
filenames :-) You can use FTS to look for specific text content in a
text file, or an album artist in a music file, or filenames with a given
extension...

See this page to get a rough idea of what FTS supports:
https://live.gnome.org/Tracker/Documentation/Examples/SPARQL/FTS

Cheers,

Note that you can always add an additional filter
fn:contains(?filename, "foobar") to support searching whatever part of
the filename... Doesn't needle have a "match in filename" mode? I'm
pretty sure there is a button to do that.

Yes, the query we use there is:

"""
SELECT ?urn nie:url(?urn)
       tracker:coalesce(nie:title(?urn),
                        nfo:fileName(?urn))
       nie:url(?urn)
       nfo:fileSize(?urn)
       nfo:fileLastModified(?urn)
       nie:url(?urn)
WHERE {
       FILTER (fn:contains (fn:lower-case (nfo:fileName(?urn)),
                            "name")) .
       ?urn nfo:belongsToContainer ?parent ;
       tracker:available true .
}
OFFSET 0 LIMIT 100
"""

--
Regards,
Martyn

Founder and CEO of Lanedo GmbH.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]