Contents

Static Index

Unlike regular Beagle indexes, which are updated in real time, static indexes are created/updated only on demand. Once created, they can be used but the results will not reflect the changes since the index was created.

Using Static Indexes

To use static indexes you first need to create the static index using beagle-build-index, and then add the index to the beagled daemon's search path. Our example uses /home, commonly a network file share, to create a index for all users on our volume.

Building a Static Index

   $ beagle-build-index --recursive --deny-pattern .beagle* 
           --target /home/.beagle-static /home

Common options:

  • --source <source>: Set the source property for files in this index.
  • --recursive: Recursively find files and directories in the path.
  • --disable-directories: Do not add information for directories. This makes sense when you only want to index the files.
  • --disable-filtering: Do not extract data and metadata from the files. Only index their name, extension, path and other filesystem information. Use this to get behaviour analogous to updatedb.
  • --allow-pattern <pattern>: Only index files matching these patterns.
  • --deny-pattern <pattern>: Skip files matching these patterns. Do not use both --allow-pattern and --deny-pattern.
  • --disable-on-battery: Do not run if the system is running on a battery. Use this for automatic indexing jobs in laptops e.g. cron scripts.
  • --enable-text-cache: Store text content for the binary files and show text snippets during querying. Enabling the text cache will consume more space.
  • --enable-deletion: Remove from the index files that are deleted from the filesystem. Even if this option is not specified, querying will never return any deleted file. Specifying this option will make indexing a little bit slower.
  • --removable: Use when indexing removable medium. See below.

Configure Beagled to Use a Static Index

You can ask beagled to load a static index by passing --add-static-backend /path/to/static/index to beagled.

 $ beagled --add-static-backend /home/.beagle-static

To always load the static index, add the static index to beagled's static queryable list.

 $ beagle-config Daemon StaticQueryables /home/.beagle-static

That should be enough to get you started using static indexes.

To remove a static index from beagled,

 $ beagle-config Daemon StaticQueryables - /home/.beagle-static

beagled needs to be restarted for the addition/removal changes to take effect.

Note that, beagle version 0.0.x to 0.2.x used a different option to add/remove static indexes. For beagle version 0.2.x and earlier, use the following: To always load the static index, add the static index to beagled's static queryable list.

 $ beagle-config daemon AddStaticQueryable /home/.beagle-static

To remove a static index from beagled,

 $ beagle-config daemon DelStaticQueryable /home/.beagle-static

WARNING !

beagle-build-index will delete the contents of the directory given as the option to --target and create the static index in that directory. If the directory contains other files and directories, those need to be deleted to create the index. Current versions (> 0.2.1) of beagle-build-index refuses to continue if it finds any other files in that directory. Earlier versions of beagle-build-index simply deleted the contents of the target directory before continuing. In any case, double check the option to --target while using beagle-build-index.

Indexing Removable Medium

Removable mediums like USB keys, data CDs, external hard drives can be searched by creating a static index as described above.

Since removable medium can be inserted or removed while beagled is running, beagled needs to be informed about these operations. You have to use the tool beagle-removable-index for this. In the future we plan to make beagle aware of medium insertion or removal.

It is not easy for beagle to decide where to store the index. Some medium like external hard-drives are writable and some like CDs are not. Also different users have different preferences on where to save the index. As of now we leave the decision entirely to the user. Hence the tool requires the user to specify two paths, indexdir: for storing the index and mountdir: the directory where the medium is mounted.

To inform beagled that an already indexed medium was inserted:

 $ beagle-removable-index --indexdir /path/to/index --mount /path/to/mount/directory

To ask beagled to drop a removable index that was added before. Note that this needs to be done before the medium is physically unmounted.

 $ beagle-removable-index --indexdir /path/to/index --unmount /path/to/mount/directory

beagled needs to be running for the above mounting and unmounting commands to work. Note that beagled does not remember the removable indexes across runs i.e. if you restart beagled then you need to re-run beagle-removable-index --mount... to search the indexes.


This page was last modified 13:15, 28 July 2008. This page has been accessed 21,888 times.

  
MediaWiki

Copyright © 2004-2007