Ejemplo n.º 1
0
        public Task <bool> TryLoad()
        {
            AppSearchFrequency.Load();

            foreach (var file in LoadFileList())
            {
                var name = Path.GetFileName(file.ToLower());

                _trie.Add(name, file);

                if (!file.Contains(" "))
                {
                    continue;
                }

                // Support search for "Mozilla Firefox" through both "Mozilla" and "Firefox"
                var variations = name.Split(" ");
                foreach (var variation in variations)
                {
                    _trie.Add(variation, file);
                }

                // Support "Visual Studio Code" -> "VSC"
                if (variations.Length > 1)
                {
                    var fuzz = string.Join(',', variations.Select(part => part[0]).ToArray()).Replace(",", "");
                    _trie.Add(fuzz, file);
                }
            }

            IsLoaded = true;
            return(Task.FromResult(IsLoaded));
        }
Ejemplo n.º 2
0
        public async IAsyncEnumerable <AbstractQueryResult> Process(Query query)
        {
            var rawQuery = query.RawQuery.ToLower();

            LastQuery = rawQuery;

            foreach (var result in _trie.Retrieve(rawQuery)
                     .OrderByDescending(entry => AppSearchFrequency.FrequencyOfFor(rawQuery, entry)))
            {
                yield return(new AppResult(result));
            }
        }
Ejemplo n.º 3
0
        public bool TryLoad()
        {
            AppSearchFrequency.Load();

            foreach (var file in LoadFileList())
            {
                var name = Path.GetFileName(file.ToLower());

                _trie.Add(name, file);

                // Support search for "Mozilla Firefox" through both "Mozilla" and "Firefox"
                if (file.Contains(" "))
                {
                    var variations = name.Split(" ");
                    foreach (var variation in variations)
                    {
                        _trie.Add(variation, file);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 4
0
 public override void OnSelect()
 {
     AppSearchFrequency.Track(AppSearchPlugin.LastQuery, _filePath);
     Process.Start("explorer.exe", "\"" + _filePath + "\"");
 }
Ejemplo n.º 5
0
 public override void OnSelect()
 {
     AppSearchFrequency.Track(_query, _app.FilePath);
     _app.Open();
 }
Ejemplo n.º 6
0
 public void Unload()
 {
     _trie = null;
     AppSearchFrequency.Reset();
 }