87e9262001-06-22Martin Nilsson // This file is part of Roxen Search // Copyright © 2000,2001 Roxen IS. All rights reserved.
5f4e122000-05-15Martin Nilsson //
9ad9b72001-06-23Johan Schön // $Id: module.pmod,v 1.16 2001/06/23 00:21:09 js Exp $
5f4e122000-05-15Martin Nilsson 
9ad9b72001-06-23Johan Schön private mapping filter_mimetypes; private multiset filter_fields;
ca4c382001-05-17Johan Schön  private void get_filters()
7ec58b2000-10-26Johan Schön {
9ad9b72001-06-23Johan Schön  filter_mimetypes=([]); filter_fields=(<>);
ca4c382001-05-17Johan Schön  foreach(values(Search.Filter), object filter)
9ad9b72001-06-23Johan Schön  {
ca4c382001-05-17Johan Schön  foreach(filter->contenttypes || ({ }), string mime)
9ad9b72001-06-23Johan Schön  filter_mimetypes[mime]=filter; foreach(filter->fields || ({ }), string field) filter_fields[field]=1; }
5f4e122000-05-15Martin Nilsson }
78fadb2000-11-30Johan Schön Search.Filter.Base get_filter(string mime_type)
7ec58b2000-10-26Johan Schön {
9ad9b72001-06-23Johan Schön  if(!filter_mimetypes)
ca4c382001-05-17Johan Schön  get_filters();
9ad9b72001-06-23Johan Schön  if(!filter_mimetypes[mime_type]) return 0; return filter_mimetypes[mime_type];
5f4e122000-05-15Martin Nilsson }
ca4c382001-05-17Johan Schön mapping(string:Search.Filter.Base) get_filter_mime_types()
7ec58b2000-10-26Johan Schön {
9ad9b72001-06-23Johan Schön  if(!filter_mimetypes)
ca4c382001-05-17Johan Schön  get_filters();
9ad9b72001-06-23Johan Schön  return filter_mimetypes;
5f4e122000-05-15Martin Nilsson }
9ad9b72001-06-23Johan Schön array(string) get_filter_fields() { if(!filter_fields) get_filters(); return indices(filter_fields);
6b3def2000-10-27Martin Nilsson }