Overview of Mac OS X spotlight

Source: Internet
Author: User
Document directory
  • Other methods:
Overview of Spotlight on Mac OS X

Spotlight is one of the highlights of the Apple OS X system. Its quick search is hard to find by other systems such as Windows. It has the following features:

  • It is fast, fast, and intelligent.
  • It exists in many places, such as the finder, system menu, open and save dialog boxes, and mail.
  • It automatically creates/updates indexes for installed disks, except for network and DVD disks.
  • It not only searches for common files, but also contacts, emails, music in iTunes, photos in iPhoto, calendar events, system files, and so on.
  • It does not: hide a file (. Hidden), an invisible file (invisible), or a file in a hidden or invisible folder.
  • In addition to creating indexes for all user directories, it also applies to/applications,/library/preerencepanes/system/library/preerencepanes
  • In the finder, command + F opens a window
  • You can search for multiple attributes of various files, such as file lable and system files.
  • Related System Processes: MDS, mdimport, mdworker.
  • It can be used even in security mode.
  • It supports plug-ins. Suitable plug-ins are used to search for projects in a specific database.
  • As files increase, it occupies more disk space, but the user is not aware of it.
  • Other options: Find any file, easyfind, find file, etc.
Basic usage:
  • Spotlight:
    In the system menu bar, click the magnifier button in the upper-right corner of the screen, or use the shortcut key (command + sapce) to enter the features to be searched in the spotlight blue search bar, it will list related projects below. I usually enter the name of a program, such as a calculator. If I only enter Cal, the calculator will be called the first candidate. I press enter to start the calculator program.
  • In finder:
    You can also enter search features in the rightmost Toolbar of the finder window, which is also the search bar. The system will also list related items at any time. During the search, a search header appears at the top of the file list area. You can easily switch the search range-whether the current computer or the disk is started, it is related to search by-content or file name. Unlike spotlight, you can perform advanced search, that is, add/use various search conditions. You only need to click the "+" button with the most edges in the search, and another one appears below. Here you can add one condition, and the leftmost is the condition type, the most common types are file type, modification time, creation time, last open time, followed by specific conditions, input at any time, and the list below is updated at any time, which is very convenient.
  • Save/Open
    You can also use the above finder search method when saving/opening a file. The specific operation is similar to the above.
  • Change the search result sequence:
    Go to the spotlight of system preerences and drag each item to change the order. If you delete the selection, the results of this type will not appear in the search results.
Basic troubleshooting:

In general, it works quite well, but spotlight does not work in the system that has been upgraded or installed or modified multiple times by itself. To solve the problem, follow the steps below. After trying each step, you need to wait for a period of time, which may be a few seconds or a minute or two. It is generally not necessary to wait for a long time.
1: restart the computer
This is always the first thought.
2: delete the com. Apple. spotlight. plist file.
This file is stored in the user's personal file home on the retaining wall ~ /Library/preferences folder
3: Go to spotligh's privacy in system preferences, add the system disk to the list, wait a few seconds, and then delete it. Generally, this can be solved.
4: Kill the systemuiserver Process
Go to activity monitor in the utilities folder, find and select "systemuiserver", and click "Quit process ". Wait a moment, and the system menu bar will appear again.
5: Command Line
Sudo find/-INAME '. Spotlight-V100'-type D-maxdepth 3-print0 | xargs-0-T-N1 sudo Rm-RF
Sudo mdutil-E/
6: Read the subsequent explanation in detail and try every way.

Stop indexing:

Although it is very useful and many people like it, you may still want to stop it out of some idea, whether it is temporary or permanent. For example, some think it is too resource-consuming, leading to a decline in the system speed; some say it crashes, it is better not. In another case, you may want to temporarily disable it or partially disable it. In other cases, spotlight may pose a security risk, but a person who does not want to be searched by other users can be searched, although it may not be accessible, it is also insecure (in most cases, it may be caused by bad habits ). In short, we want users to control its opening, partially opening, or completely disabling it.

Command line:
  1. Hostconfig
    If you are running a system earlier than Mac OS X 10.5, you can disable it. Modify spotlight =-no-in/etc/hostconfig -.
    It is also easy to re-open. Change it to the default-yes-. You can restart the system. However, you must have the administrator privilege for this method.
  2. Use Gui
    In the spotlight of system preferences, in the Privacy label, drag the hard drive letter of the local machine to the list, and the system prompts you to confirm. Afterwards, spotlight will no longer work.

    Copyright information
    : In line with the principle of open exchange, you are welcome to reprint, unless you explicitly declare "decline to reprint.



    All articles, images, and codes (except for reprinting and translation) are copyrighted by the author of the article.


    .
    Reprinted in accordance with the following rules:
    1) maintain the integrity of the article; 2) do not aim at making profits; 3) mark the author of the article [Tony Liu @ China Online Education
    ] And all copyright information in the article.
    Other matters, such as: the need for commercial purposes or for profit purposes, or part of the reprint, please contact the author: TonyLiu2CA@yahoo.com



    If the current system hard disk is disabled, the search function cannot be used in spotlight and finder, and cannot be entered in the search bar.
    Of course, you can disable searching for specific directories. In the same way, you can drag them to the list. Once a directory or disk is dragged and dropped, Spolight immediately stops indexing it and cannot find the files in it from the finder, although the stored indexes still exist in the system.
    Once a directory is added to privacy, it will not appear in the search results.
    In the past, problems may occur in the system. For example, when spotlight is creating an index, it may generate an MDS-crash-state file, even if you remove it from privacy, he still cannot re-create the index. The solution is to unmount the disk and install it again, restart the system, or delete the file (. in the Spotlight-V100 directory), or run the re-Index Command: sudo mdutil-E/path_to_volume
    To open it, delete it from the list. After deletion, spotlight will be automatically updated. This speed may last for several minutes or longer depending on the number of your system and files.

  3. Sudo mdutil-I off/path_to_volume
    This command can be applied to a disk (partition) and not to a directory. This prohibited disk will not appear in the Privacy list of spotlight.
    If sudo mdutil-I off/
    That is to say, disable the index of the entire disk. Run this command: The system does not start MDs to index the disk in the background, but the find function can still be used in the finder, however, this function is similar to normal search in windows, and is slow because no data index can be used is available, which is similar to the find command in the command line, however, it does not look for programs or content in various packages. Compared with the preceding prohibition of pravicy In the GUI, there are some differences. This function may still be used. For example, you do not want the system to index at any time, but you also need to retain the file search function in the finder.
Other methods:


Use third-party software, such as onyx/quicksilver

Relationship between command line and Gui:

In versions earlier than Mac OS X 10.6, spotlight in command line and system preferences is incompatible. However, this situation has been improved.
For example, if a directory is added to privacy in spotlight, the command line can still run-I off or-I on, but in snow leopard, it is no longer working, when you use-I on, it will prompt indexing and searching disabled.
For example, if you add a directory to privacy, the previous version may not immediately delete the index data, but the current version will be immediately deleted.

As mentioned above, you can still search for files in the GUI by disabling Indexing in the command line.

Other commands

Sudo mdutil-E/
Re-create the index of the system disk. If pravicy is disabled in the GUI, this command does not work.

Sudo launchctl unload/system/library/launchdaemons/COM. Apple. Metadata. MDs. plist
Stop the MDS service. The next time the system restarts, the MDS service restarts.

Sudo launchctl unload-W/system/library/launchdaemons/COM. Apple. Metadata. MDs. plist
Stop the MDS service. The next time the system restarts, the MDS service will not be restarted.

Sudo launchctl load/system/library/launchdaemons/COM. Apple. Metadata. MDs. plist
If you need to start the MDS service immediately after it is stopped, run this command.

 

Under the HOOD:

The following content is more than a curious attempt. You can use it only after you actually understand the content described below. Otherwise, you will be at your own risk.


Spotlight indexes are created in the. Spotlight hidden directory under the directories of each disk.

The list content in the System Preference spotlight's privacy is stored in a file called exclusions. plist.
The Order options of search results are defined in the com. Apple. spotlight. plist file of the current user's personal folder.

If you do not want to use the GUI to perform privacy operations, you need to use the command line. The following is an example.
# Start
Defaults delete/. Spotlight-V100/exclusions
Defaults write/. Spotlight-V100/exclusions-array
Launchctl unload/system/library/launchdaemons/COM. Apple. Metadata. MDs. plist
Launchctl load/system/library/launchdaemons/COM. Apple. Metadata. MDs. plist
# End

There is also a thorough approach:
# Start
Sudo launchctl unload-W/system/library/launchdaemons/COM. Apple. Metadata. MDs. plist
Mkdir/system/library/launchagnets. Backup
Sudo mV/system/library/launchagnets/COM. Apple. metadata_mdwrite/system/library/launchagnets
CD/system/library/frameworks/coreservices. Framework/frameworks/metadata. Framework/support/
Tar-CVF mdworkstuff.tar./# (saves all MD * To A tarball in case you ever want it back)
Then:
Rm mdworker
Rm mdworker32
Rm MDS
Rm mdwrite
# End

 

 

Tony Liu in Calgary

2011, 03, 03

-18 windchill-35

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.