Exemplo n.º 1
0
        ////////////////////////////////////////////////////////

        // Scans PathFinder.SystemIndexesDir after available
        // system-wide indexes.
        static void LoadSystemIndexes()
        {
            if (!Directory.Exists(PathFinder.SystemIndexesDir))
            {
                return;
            }

            Logger.Log.Info("Loading system static indexes.");

            int count = 0;

            Queryable queryable;

            foreach (DirectoryInfo index_dir in new DirectoryInfo(PathFinder.SystemIndexesDir).GetDirectories())
            {
                if (!UseQueryable(index_dir.Name))
                {
                    continue;
                }

                queryable = StaticQueryable.LoadStaticQueryable(index_dir, QueryDomain.System);
                if (queryable != null)
                {
                    iqueryable_to_queryable [queryable.IQueryable] = queryable;
                    count++;
                }
            }

            Logger.Log.Info("Found {0} system-wide indexes.", count);
        }
Exemplo n.º 2
0
        // Scans configuration for user-specified index paths
        // to load StaticQueryables from.
        static void LoadStaticQueryables()
        {
            int count = 0;

            if (UseQueryable("static"))
            {
                Logger.Log.Info("Loading user-configured static indexes.");
                List <string[]> values = Conf.Daemon.GetListOptionValues(Conf.Names.StaticQueryables);
                if (values != null)
                {
                    foreach (string[] path in values)
                    {
                        static_queryables.Add(path [0]);
                    }
                }
            }

            Queryable queryable;

            foreach (string path in static_queryables)
            {
                DirectoryInfo index_dir = new DirectoryInfo(StringFu.SanitizePath(path));

                if (!index_dir.Exists)
                {
                    continue;
                }

                // FIXME: QueryDomain might be other than local
                queryable = StaticQueryable.LoadStaticQueryable(index_dir, QueryDomain.Local);
                if (queryable != null)
                {
                    iqueryable_to_queryable [queryable.IQueryable] = queryable;
                    count++;
                }
            }

            Logger.Log.Info("Found {0} user-configured static indexes..", count);

            static_queryables = null;
        }