70
69
(lastQueryTime - queryStartTime).TotalSeconds);
73
if (verbose && response.NumMatches >= 0)
74
Console.WriteLine ("Returned latest {0} results out of total {1} matches", response.Hits.Count, response.NumMatches);
73
if (response.NumMatches >= 0)
74
Console.WriteLine ("Returned latest {0} results out of total {1} matches", response.Hits.Count, response.NumMatches);
76
Console.WriteLine ("Returned latest {0} results", response.Hits.Count);
76
79
if (! display_hits) {
77
80
count += response.Hits.Count;
178
181
" --max-hits\t\tLimit number of search results per backend\n" +
179
182
" \t\t(default 100)\n" +
181
" --network <yes|no>\tQuery other beagle systems in the network specified in config (default no)\n" +
184
" --domain <local|system|network|global|all> Specify query domain (default local + system)\n" +
183
186
" --flood\t\tExecute the query over and over again. Don't do that.\n" +
184
187
" --listener\t\tExecute an index listener query. Don't do that either.\n" +
194
197
System.Environment.Exit (0);
197
private static void ReadBackendMappings ()
199
ArrayList assemblies = ReflectionFu.ScanEnvironmentForAssemblies ("BEAGLE_BACKEND_PATH", PathFinder.BackendDir);
201
// Add BeagleDaemonLib if it hasn't already been added.
202
bool found_daemon_lib = false;
203
foreach (Assembly assembly in assemblies) {
204
if (assembly.GetName ().Name == "BeagleDaemonLib") {
205
found_daemon_lib = true;
210
if (!found_daemon_lib) {
212
assemblies.Add (Assembly.LoadFrom (Path.Combine (PathFinder.PkgLibDir, "BeagleDaemonLib.dll")));
213
} catch (FileNotFoundException) {
214
Console.WriteLine ("WARNING: Could not find backend list.");
215
Environment.Exit (1);
219
foreach (Assembly assembly in assemblies) {
220
foreach (Type type in ReflectionFu.GetTypesFromAssemblyAttribute (assembly, typeof (IQueryableTypesAttribute))) {
221
object[] attributes = type.GetCustomAttributes (false);
222
foreach (object attribute in attributes) {
223
PropertyKeywordMapping mapping = attribute as PropertyKeywordMapping;
226
//Logger.Log.Debug (mapping.Keyword + " => "
227
// + mapping.PropertyName +
228
// + " is-keyword=" + mapping.IsKeyword + " ("
229
// + mapping.Description + ") "
230
// + "(" + type.FullName + ")");
231
PropertyKeywordFu.RegisterMapping (mapping);
237
200
private static void OnClosed ()
314
279
keep_running = true;
316
281
case "--keywords":
317
ReadBackendMappings ();
318
QueryDriver.ReadKeywordMappings ();
282
PropertyKeywordFu.ReadKeywordMappings ();
320
284
Console.WriteLine ("Supported query keywords are:");
322
286
foreach (string key in PropertyKeywordFu.Keys) {
323
foreach (PropertyDetail prop in PropertyKeywordFu.Properties (key)) {
287
foreach (QueryKeywordMapping mapping in PropertyKeywordFu.Properties (key)) {
324
288
// Dont print properties without description; they confuse people
325
if (string.IsNullOrEmpty (prop.Description))
289
if (string.IsNullOrEmpty (mapping.Description))
327
Console.WriteLine (" {0,-20} for {1}", key, prop.Description);
291
Console.WriteLine (" {0,-20} for {1}", key, mapping.Description);
331
295
System.Environment.Exit (0);
335
299
if (++i >= args.Length) PrintUsageAndExit ();
336
if (args [i].ToLower () == "yes")
337
query.AddDomain (QueryDomain.Neighborhood);
300
switch (args [i].ToLower ()) {
302
domain |= QueryDomain.Local;
306
domain |= QueryDomain.System;
310
domain |= QueryDomain.Neighborhood;
314
domain |= QueryDomain.Global;
318
domain |= QueryDomain.All;
322
PrintUsageAndExit ();