AFP548

Using apple_spotlight_module in Tiger Server

Sherlock is back!

If you remember back in the day when Apple was touting Sherlock indexing for webpages, this is for you. You can now do this with Spotlight, which should yield a more consistent experience.1.Prepare Mac OS X Server for Spotlight

SPOTLIGHT=-YES-

usage: mdutil -pE volume ...
mdutil can be used to manage the metadata stores used by Spotlight.
    -p publish metadata for the provided volumes.
    -i (on|off) set indexing status for the provided volumes.
    -E erase the master copy of the metadata stores for the provided volumes.
    -s print indexing status for the provided volumes.

mdutil -s /Volumes/Data # show the status for volume : /Volumes/Data
    /Volumes/Data:
    Status: Indexing Disabled

mdutil -i on /Volumes/Data # activate indexing for the volume : /Volumes/Data
    /Volumes/Data:
    Indexing enabled for volume.

mdutil -p /Volumes/Data # publish index for the volume : /Volumes/Data
    /Volumes/Data:
    Index published
    Server is now ready for using spotlight

2. Prepare Apache for using Spotlight

LoadModule apple_spotlight_module libexec/httpd/mod_spotlight_apple.so
AddModule mod_spotlight_apple.c

www.mydomaine.com/.spotlight
www.mydomaine.com/fr/xserve.spotlight

3. Integrating the search module directly in the webpage

<code>
&lt;/HEAD&gt;
    &lt;BODY BGCOLOR="#FFFFFF"&gt;
    &lt;CENTER&gt;
    &lt;TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=600&gt;
        &lt;TR&gt;
            &lt;TD&gt;
            &lt;TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0&gt;
                &lt;TR&gt;
                    &lt;TD&gt;
                    &lt;FORM ACTION=".spotlight" METHOD="post"&gt;
                    &lt;INPUT NAME="search" TYPE="text"&gt;
                    &lt;INPUT TYPE="submit" VALUE="Search"&gt;
                    &lt;!-- Limits the number of hits presented --&gt;
                    &lt;INPUT TYPE="hidden" NAME="maxhits" VALUE="100"&gt;
                    &lt;/FORM&gt;
                    &lt;/TD&gt;
                &lt;/TR&gt;
            &lt;/TABLE&gt;
            &lt;BR&gt;
            &lt;IMG SRC="grayline.gif" WIDTH=600 HEIGHT=1 ALIGN=bottom&gt;&lt;BR&gt;
            &lt;BR&gt;
            &lt;BR&gt;
            &lt;TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=600&gt;
                &lt;TR&gt;
                    &lt;TD VALIGN=top&gt;
                    &lt;BR&gt;
                    &lt;FONT SIZE="+1" FACE="Arial" COLOR="#999999"&gt;&lt;B&gt;Spotlight Content Search Results&lt;/B&gt;&lt;/FONT&gt;
                      &lt;/TD&gt;
                      &lt;TD&gt;
                  &lt;!--Dynamic content will go here (no spaces before or after!)--&gt;
                  &lt;SPOTLIGHTOUT&gt;
                  &lt;!--End of dynamic content section--&gt;
                      &lt;/TD&gt;
                  &lt;/TR&gt;
             &lt;/TABLE&gt;
            &lt;BR&gt;
            &lt;BR&gt;
            &lt;CENTER&gt;&lt;IMG SRC="grayline.gif" WIDTH=600 HEIGHT=1 ALIGN=bottom&gt;&lt;BR&gt;
            &lt;P&gt;(c) Copyright 2004 Apple Computer, Inc.&lt;/P&gt;&lt;/CENTER&gt;
        &lt;/TD&gt;
    &lt;/TR&gt;
&lt;/TABLE&gt;
&lt;/CENTER&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
</code>

That’s just an example to get you started.

Exit mobile version