1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" lang=
"pt-PT" xml:
lang=
"pt-PT">
7 * Copyright 2008-2009, Haiku. All rights reserved.
8 * Distributed under the terms of the MIT License.
11 * Humdinger <humdingerb@gmail.com>
14 <meta http-equiv=
"content-type" content=
"text/html; charset=utf-8" />
15 <meta http-equiv=
"Content-Style-Type" content=
"text/css" />
16 <meta name=
"robots" content=
"all" />
17 <title>Queries
</title>
18 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0" />
19 <link rel=
"stylesheet" type=
"text/css" href=
"../Haiku-doc.css" />
24 <div><span>User guide
</span></div>
29 <ul class=
"lang-menu">
30 <li class=
"now"><img src=
"../images/flags/pt_PT.png" alt=
"" /> Português
</li>
31 <li><a href=
"../ca/queries.html"><img src=
"../images/flags/ca.png" alt=
"" />Català
</a></li>
32 <li><a href=
"../de/queries.html"><img src=
"../images/flags/de.png" alt=
"" />Deutsch
</a></li>
33 <li><a href=
"../en/queries.html"><img src=
"../images/flags/gb.png" alt=
"" />English
</a></li>
34 <li><a href=
"../es/queries.html"><img src=
"../images/flags/es.png" alt=
"" />Español
</a></li>
35 <li><a href=
"../fr/queries.html"><img src=
"../images/flags/fr.png" alt=
"" />Français
</a></li>
36 <li><a href=
"../it/queries.html"><img src=
"../images/flags/it.png" alt=
"" />Italiano
</a></li>
37 <li><a href=
"../hu/queries.html"><img src=
"../images/flags/hu.png" alt=
"" />Magyar
</a></li>
38 <li><a href=
"../pl/queries.html"><img src=
"../images/flags/pl.png" alt=
"" />Polski
</a></li>
39 <li><a href=
"../pt_BR/queries.html"><img src=
"../images/flags/pt_BR.png" alt=
"" />Português (Brazil)
</a></li>
40 <li><a href=
"../ro/queries.html"><img src=
"../images/flags/ro.png" alt=
"" />Română
</a></li>
41 <li><a href=
"../sk/queries.html"><img src=
"../images/flags/sk.png" alt=
"" />Slovenčina
</a></li>
42 <li><a href=
"../fi/queries.html"><img src=
"../images/flags/fi.png" alt=
"" />Suomi
</a></li>
43 <li><a href=
"../sv_SE/queries.html"><img src=
"../images/flags/sv_SE.png" alt=
"" />Svenska
</a></li>
44 <li><a href=
"../zh_CN/queries.html"><img src=
"../images/flags/zh_CN.png" alt=
"" /> 中文 [中文]
</a></li>
45 <li><a href=
"../ru/queries.html"><img src=
"../images/flags/ru.png" alt=
"" />Русский
</a></li>
46 <li><a href=
"../uk/queries.html"><img src=
"../images/flags/uk.png" alt=
"" />Українська
</a></li>
47 <li><a href=
"../jp/queries.html"><img src=
"../images/flags/jp.png" alt=
"" />日本語
</a></li>
50 «
<a href=
"index.html">Index
</a>
51 ::
<a href=
"contents.html" class=
"uplink">Contents
</a>
52 ::
<a href=
"workshop-filetypes+attributes.html">Workshop
</a> »
58 <div class=
"box-info">The translation of this page isn't yet complete. Until it is, unfinished parts use the English original.
</div>
61 <table class=
"index" id=
"index" summary=
"index">
62 <tr class=
"heading"><td>Index
</td></tr>
63 <tr class=
"index"><td>
64 <a href=
"#find-window">The Find window
</a><br />
65 <a href=
"#basic-query">Basic queries -
"by Name"</a><br />
66 <a href=
"#adv-query">Advanced queries -
"by Attribute"</a><br />
67 <a href=
"#more-adv-query">Even more advanced queries -
"by Formula"</a><br />
68 <a href=
"#result-window">The result window
</a><br />
69 <a href=
"#query-template">Query Templates
</a>
75 <p>A query is a file search based on file attributes and can be performed within Tracker or in Terminal. Queries are saved in
<span class=
"path">/boot/home/queries/
</span> and by default last seven days before being purged. Note, these aren't static result lists of your search, but are the query formulas which trigger a new search whenever you open them.
<br />
76 Even better, you don't have to double-click to re-do a query. You can
<a href=
"tracker.html#navigating">drill down
</a> a saved query just like any folder by right-clicking on it and navigating through the submenus.
</p>
79 <a href=
"#"><img src=
"../images/up.png" style=
"border:none;float:right" alt=
"index" /></a>
80 <a id=
"find-window" name=
"find-window">The Find window
</a></h2>
81 <p>You start a query by invoking the
<span class=
"menu">Find...
</span> menu either from the Deskbar menu or any Tracker window or the Desktop (which is actually a fullscreen Tracker window). The shortcut is
<span class=
"key">ALT
</span> <span class=
"key">F
</span>. You're presented with the Find window:
</p>
82 <img src=
"images/queries-images/basic-query.png" alt=
"basic-query.png" />
84 <li><p>Select recent or saved queries or save the current search parameters as
<a href=
"#query-template">Query Template
</a>.
</p></li>
85 <li><p>Narrow down your search from
<span class=
"menu">All files and folders
</span> to specific file types.
</p></li>
86 <li>Define the search method:
<ul>
87 <li><span class=
"menu">by Name
</span> - a basic search by file or folder name
</li>
88 <li><span class=
"menu">by Attribute
</span> - an advanced search, you specify search terms for one or more attributes
</li>
89 <li><span class=
"menu">by Formula
</span> - an even more advanced search, you can fine-tune a complex query term
</li></ul></li>
90 <li><p>Select which drives to search on.
</p></li>
91 <li><p>Enter the search term.
</p></li>
92 <li><p>The expander hides/unhides the additional options.
</p></li>
93 <li><p>Uncheck the
<span class=
"menu">Temporary
</span> checkbox if you don't want this query self-destruct after
7 days.
</p></li>
94 <li><p>Check if your query is supposed to
<span class=
"menu">Include trash
</span>.
</p></li>
95 <li><p>Optionally, enter a name for this query if you want to save it.
</p></li>
96 <li><p>You can drag
&drop the icon anywhere to save a query. Doing that with the right mouse button, offers the option to save as template.
</p></li>
100 <a href=
"#"><img src=
"../images/up.png" style=
"border:none;float:right" alt=
"index" /></a>
101 <a id=
"basic-query" name=
"basic-query">Basic queries -
"by Name"</a></h2>
102 <p>If you simply want to find all files and folders on your mounted disks that match a certain pattern, simply leave the search method at
<span class=
"menu">by Name
</span>, enter the search term into the text box and press
<span class=
"key">ENTER
</span>.
</p>
105 <a href=
"#"><img src=
"../images/up.png" style=
"border:none;float:right" alt=
"index" /></a>
106 <a id=
"adv-query" name=
"adv-query">Advanced queries -
"by Attribute"</a></h2>
107 <p>You can create more advanced queries by searching within the attributes of specific file types. For that to work, these attributes have to be
<a href=
"index.html">indexed
</a>.
</p>
108 <img src=
"images/queries-images/query-window.png" alt=
"query-window.png" />
109 <p>You start by setting the filetype from
<span class=
"menu">All files and folders
</span> to, for example,
<span class=
"menu">Text | E-mail
</span> and change the search method to
<span class=
"menu">by Attribute
</span>.
</p>
110 <p>This adds a pop-up menu to the left of the textbox and the buttons
<span class=
"button">Add
</span> and
<span class=
"button">Remove
</span> under that. From the menu you choose which attribute to query. With
<span class=
"button">Add
</span> and
<span class=
"button">Remove
</span> you can query additional attributes or remove them again. These attributes can be logically linked with AND/OR.
</p>
111 <p>Let's do an email query as an example:
</p>
112 <img src=
"images/queries-images/query-window-filled.png" alt=
"query-window-filled.png" />
113 <p>This is your Find window when you're looking for all emails Clara Botters has sent to you in the last two months that had in the subject
"vibraphone" or
"skepticality".
<br />
114 As you see, searching through time-based attributes supports some useful phrases: besides for the
"last 2 months", you could also use
"today",
"yesterday",
"Monday" or
"last Monday" (which would be the Monday last week), or
"last 2 minutes/hours/days/weeks".
<br />
115 A good way to cut down the number of search results.
</p>
118 <a href=
"#"><img src=
"../images/up.png" style=
"border:none;float:right" alt=
"index" /></a>
119 <a id=
"more-adv-query" name=
"more-adv-query">Even more advanced queries -
"by Formula"</a></h2>
120 <p>Typing in a formula query by hand is daunting and really quite unpractical. It still has its uses.
</p>
121 <p>Take the above query by attribute of Clara's mails concerning vibraphones etc. If you have all the attributes and their search terms set, try switching to
<span class=
"menu">by Formula
</span> mode and be overwhelmed by this one line query string:
</p>
122 <img src=
"images/queries-images/formula-query.png" alt=
"formula-query.png" />
123 <p>Once more as text, edited for readability:
</p>
124 <pre>(((((MAIL:from==
"*[cC][lL][aA][rR][aA] [bB][oO][tT][tT][eE][rR][sS]*")
125 &&(MAIL:when
>=%
2 months%))
126 &&(MAIL:subject==
"*[vV][iI][bB][rR][aA][pP][hH][oO][nN][eE]*"))
127 ||(MAIL:subject==
"*[sS][kK][eE][pP][tT][iI][cC][aA][lL][iI][tT][yY]*"))
128 &&(BEOS:TYPE==
"text/x-email"))
</pre>
129 <p>What's the use?
</p>
131 <li><p>You could copy and paste the string into an email, forum or IRC for others to use or debug.
</p></li>
132 <li><p>You can use this method to construct a query in
<span class=
"menu">Attribute
</span> mode and then switch to
<span class=
"menu">Formula
</span> mode, to comfortably generate a search string to use for a query in Terminal or a script.
</p></li>
133 <li><p>You can fine tune your query by inserting parenthesis where needed, make parts case-sensitive or negate logical combinations by changing. e.g.
"<tt>==</tt>" to
"<tt>!=</tt>" for a NOT AND. All you need is a basic understanding of
<a href=
"http://en.wikipedia.org/wiki/Regular_expression" class=
"external free" title=
"Wikipedia: Regular expression">regular expressions
</a> and maybe some scripting basics.
</p></li>
137 <a href=
"#"><img src=
"../images/up.png" style=
"border:none;float:right" alt=
"index" /></a>
138 <a id=
"result-window" name=
"result-window">The result window
</a></h2>
139 <p>After you start a search, the Find window will be replaced by a result window. Here is an example that queried for
"server":
</p>
140 <img src=
"images/queries-images/result-window.png" alt=
"result-window.png" />
141 <p>Besides the gray background, result windows work exactly like any other Tracker window. Some things are worth noting:
</p>
143 <li><p>You can open the location of a file or folder by double clicking on its path attribute.
</p></li>
144 <li><p>With
<span class=
"menu">File | Edit query
</span> or
<span class=
"key">ALT
</span> <span class=
"key">G
</span> you get back to your Find window to refine your query.
</p></li>
145 <li><p>A query is live, i.e. if a file that matches your search criteria appears or disappears from your system, this change is reflected in your results in real-time.
</p></li>
147 <p>You can assign a sensible attribute layout for query results of a specific filetype. Open a folder containing files of the filetype you'd like to create a template for and arrange the attributes how you'd like to have query results presented. Copy this layout with
<span class=
"menu">Attributes | Copy layout
</span>.
</p>
148 <p>Open
<span class=
"path">/boot/home/config/settings/Tracker/DefaultQueryTemplates
</span>, create a new folder named
<i>group/filetype
</i>, replacing the slash with an underscore, e.g.
"audio_x-mp3". Open the new folder and paste in the previously copied layout with
<span class=
"menu">Attributes | Paste layout
</span>.
</p>
152 <a href=
"#"><img src=
"../images/up.png" style=
"border:none;float:right" alt=
"index" /></a>
153 <a id=
"query-template" name=
"query-template">Query Templates
</a></h2>
154 <p>If you double click a saved query, the file search is at once started and the result window opens immediately. However, you may not want to search with these
<i>exact
</i> search parameters, but use it as starting point to only slightly tweak the formula.
<br />
155 By using the
<span class=
"menu">Save query as template
</span> menu item (see
<a href=
"#find-window">(
1) in screenshot
</a> at the top) or drag
&dropping the icon (
10) anywhere with the right mouse button, you can create just such a template. Double clicking it won't open a result window, but the Find panel, giving you the opportunity to quickly change search strings or add/remove attributes.
</p>
156 <p>Wherever you choose to save query templates, they'll be listed in the Find panel's menu of recent queries.
</p>
161 <div class=
"inner"><span>
162 «
<a href=
"index.html">Index
</a>
163 ::
<a href=
"contents.html" class=
"uplink">Contents
</a>
164 ::
<a href=
"workshop-filetypes+attributes.html">Workshop
</a> »