索引 |
查询窗口 基本查询 - "使用名字" 标准查询 - "使用属性" 高级查询 - "使用表达式" 结果窗口 查询模板 |
查询
查询是基于文件属性的文件搜索,可以在Tracker或者终端中进行。所有的查询保存在 /boot/home/queries/ ,并且保持七天才予以清除。需要注意的是,这些并不是您静态的搜索结果列表,而是查询的规则,当您打开它们时,将会再次进行搜索。
比较方便的是,您不需要双击来再次执行查询,而是可以深入一个保存的查询,就如右键点击任何的文件夹,然后导航至相应的子菜单。
查询窗口
您可以从 ALT F。它将会呈现如下查找窗口:
菜单,桌面栏菜单,任何Tracker窗口,或者桌面(一个全屏的Tracker窗口)调用查询。对应的快捷键是选择最近或者保存的查询,或者保存当前的搜索参数为 查询模板。
查询范围从
缩小到特定的文件类型。- 定义搜索方法:
- - 基本搜索,基于文件或者文件夹名的查询
- - 标准搜索,基于一个或多个属性的查询
- - 高级搜索,基于查询规则的复杂查询
选择所要搜索的目标驱动。
输入搜索词。
扩展项是否隐藏附加选项。
如果您不希望查询保存7天,您可以不勾选
复选框。如果您打算查询垃圾箱,您可以选中
。可选的,如果您希望保存查询,您可以输入名字为其命名。
您可以拖拽图标到任何位置保存查询。右键点击查询文件,提供了选项将其保存为模板。
基本查询 - "使用名字"
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 ENTER.
, enter the search term into the text box and press标准查询 - "使用属性"
You can create more advanced queries by searching within the attributes of specific file types. For that to work, these attributes have to be indexed.
You start by setting the filetype from
to, for example, and change the search method to .This adds a pop-up menu to the left of the textbox and the buttons
and under that. From the menu you choose which attribute to query. With and you can query additional attributes or remove them again. These attributes can be logically linked with AND/OR.Let's do an email query as an example:
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".
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".
A good way to cut down the number of search results.
高级查询 - "使用表达式"
Typing in a formula query by hand is daunting and really quite unpractical. It still has its uses.
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
mode and be overwhelmed by this one line query string:Once more as text, edited for readability:
(((((MAIL:from=="*[cC][lL][aA][rR][aA] [bB][oO][tT][tT][eE][rR][sS]*") &&(MAIL:when>=%2 months%)) &&(MAIL:subject=="*[vV][iI][bB][rR][aA][pP][hH][oO][nN][eE]*")) ||(MAIL:subject=="*[sS][kK][eE][pP][tT][iI][cC][aA][lL][iI][tT][yY]*")) &&(BEOS:TYPE=="text/x-email"))
What's the use?
You could copy and paste the string into an email, forum or IRC for others to use or debug.
You can use this method to construct a query in
mode and then switch to mode, to comfortably generate a search string to use for a query in Terminal or a script.You can fine tune your query by inserting parenthesis where needed, make parts case-sensitive or negate logical combinations by changing. e.g. "==" to "!=" for a NOT AND. All you need is a basic understanding of regular expressions and maybe some scripting basics.
结果窗口
After you start a search, the Find window will be replaced by a result window. Here is an example that queried for "server":
Besides the gray background, result windows work exactly like any other Tracker window. Some things are worth noting:
You can open the location of a file or folder by double clicking on its path attribute.
With ALT G you get back to your Find window to refine your query.
orA 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.
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
.Open /boot/home/config/settings/Tracker/DefaultQueryTemplates, create a new folder named group/filetype, replacing the slash with an underscore, e.g. "audio_x-mp3". Open the new folder and paste in the previously copied layout with .
查询模板
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 exact search parameters, but use it as starting point to only slightly tweak the formula.
By using the menu item (see (1) in screenshot 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.
Wherever you choose to save query templates, they'll be listed in the Find panel's menu of recent queries.