// Instantiates and loads a StaticQueryable from an index directory internal static Queryable LoadStaticQueryable(DirectoryInfo index_dir, QueryDomain query_domain) { StaticQueryable static_queryable = null; if (!index_dir.Exists) { return(null); } try { static_queryable = new StaticQueryable(index_dir.Name, index_dir.FullName, true); } catch (InvalidOperationException) { Logger.Log.Warn("Unable to create read-only index (likely due to index version mismatch): {0}", index_dir.FullName); return(null); } catch (Exception e) { Logger.Log.Error(e, "Caught exception while instantiating static queryable: {0}", index_dir.Name); return(null); } if (static_queryable == null) { return(null); } // Load StaticIndex.xml from index_dir.FullName/config string config_file_path = Path.Combine(index_dir.FullName, "StaticIndex.xml"); Config static_index_config; try { static_index_config = Conf.LoadFrom(config_file_path); if (static_index_config == null) { Log.Error("Unable to read config from {0}", config_file_path); return(null); } } catch (Exception e) { Log.Error(e, "Caught exception while reading config from {0}", config_file_path); return(null); } string source = static_index_config.GetOption("Source", null); if (source == null) { Log.Error("Invalid config file: {0}", config_file_path); return(null); } QueryableFlavor flavor = new QueryableFlavor(); flavor.Name = source; flavor.Domain = query_domain; Queryable queryable = new Queryable(flavor, static_queryable); return(queryable); }
// Instantiates and loads a StaticQueryable from an index directory internal static Queryable LoadStaticQueryable (DirectoryInfo index_dir, QueryDomain query_domain) { StaticQueryable static_queryable = null; if (!index_dir.Exists) return null; try { static_queryable = new StaticQueryable (index_dir.Name, index_dir.FullName, true); } catch (InvalidOperationException) { Logger.Log.Warn ("Unable to create read-only index (likely due to index version mismatch): {0}", index_dir.FullName); return null; } catch (Exception e) { Logger.Log.Error (e, "Caught exception while instantiating static queryable: {0}", index_dir.Name); return null; } if (static_queryable == null) return null; // Load StaticIndex.xml from index_dir.FullName/config string config_file_path = Path.Combine (index_dir.FullName, "StaticIndex.xml"); Config static_index_config; try { static_index_config = Conf.LoadFrom (config_file_path); if (static_index_config == null) { Log.Error ("Unable to read config from {0}", config_file_path); return null; } } catch (Exception e) { Log.Error (e, "Caught exception while reading config from {0}", config_file_path); return null; } string source = static_index_config.GetOption ("Source", null); if (source == null) { Log.Error ("Invalid config file: {0}", config_file_path); return null; } QueryableFlavor flavor = new QueryableFlavor (); flavor.Name = source; flavor.Domain = query_domain; Queryable queryable = new Queryable (flavor, static_queryable); return queryable; }
public Queryable (QueryableFlavor flavor, IQueryable iqueryable) { this.flavor = flavor; this.iqueryable = iqueryable; }
public Queryable(QueryableFlavor flavor, IQueryable iqueryable) { this.flavor = flavor; this.iqueryable = iqueryable; }