Query the File Manager

NOTE: The following query commands DO NOT depend on the underlying catalog implementation. The names SQL and Lucene instead describe the query SYNTAX not the File Manager catalog. This means you can execute the sqlquery command against a File Manager with a Lucene index, and vice versa.

lucenequery

This will execute a Lucene Query against the filemanager catalog and return a list of ProductIDs. These Product IDs can then be piped into the fmdel alias to remove all products that match the query criteria.

Usage:

  • Return the ProductIds to the terminal window
         lucenequery "ProductType:ISMRawData"
    
  • Pipe the ProductIds to a file
         lucenequery "ProductType:ISMRawData" > ProductID_List.txt
    

sqlquery

This will execute as SQL Query against the filemanager catalog and return the metadata value(s) specified in the SELECT statement. You can also declare more than one ProductType in the FROM statement. This enables you to create metadata exports into a csv file format using this tool. In the second usage example you can chain together any number of available metadata keys to pull out the corresponding values.

Usage:

  • Return the ProductIds to the terminal window
         sqlquery "SELECT CAS.ProductId FROM GenericFile"
    
  • Create a CSV file that contains CAS.ProductId,CAS.ProductName,CAS.ProductReceivedTime. Note: You must not have any spaces between the MetKeys and the comma separator
         sqlquery "SELECT CAS.ProductId,CAS.ProductName,CAS.ProductReceivedTime FROM GenericFile" > CAS_Metadata.csv
    
  • Extract all ProductIds for Multiple ProductTypes. Again NO SPACES allowed between the commas.
         sqlquery "SELECT CAS.ProductId FROM GenericFile,ProductType2,ProductType3,ProductTypeN"
    

fmdel

Use this command to delete a single product from the catalog. This will remove the lucene index entry from the catalog and will remove the archived product from disk. (If you just want to SEE/PREVIEW what products will be removed from the archive, then you will need to use the --nocommit parameter)

Usage:

  • Preview what will be removed from catalog
         fmdel --nocommit 0691ee17-96ec-11e0-8556-3b3ca12e4f64
    
  • Remove the product from the catalog
         fmdel 0691ee17-96ec-11e0-8556-3b3ca12e4f64
    

metdump

Just added to the list. This will take in a product_id and dump out the product's metadata into the current directory. This one needs a little more testing and docs.

Examples of Combining the Tools

Remove a set of products from the catalog using the lucenequery command

Usage:

  • You want to remove all of the products that belong to the GenericFile ProductType. We merely combine the lucenequery command with the fmdel command.
         lucenequery "ProductType:GenericFile" | fmdel
    
  • No labels