Example #1
0
        private ManualResetEventSlim StartSearchInBackground(string searchString)
        {
            ManualResetEventSlim resetEvent = new ManualResetEventSlim(false);

            Task.Factory.StartNew(() =>
            {
                IEverything everything    = new Everything();
                everything.MatchWholeWord = true;

                // Act
                var results = everything
                              .Search()
                              .Name
                              .Contains(searchString);

                // Assert
                Assert.That(this.everyThing.LastErrorCode, Is.EqualTo(ErrorCode.Ok));
                Assert.That(results, Is.Not.Empty);
                foreach (var result in results)
                {
                    StringAssert.Contains(searchString, result.FileName);
                }
                resetEvent.Set();
            });

            return(resetEvent);
        }
Example #2
0
        public long QueryAndQuery()
        {
            var everything = new Everything();
            var queryable1 = everything
                             .Search()
                             .Name.Contains("windows");

            var queryable2 = everything
                             .Search()
                             .Size.LessThan(1, SizeUnit.Mb);

            return(everything
                   .Search()
                   .Queryable(queryable1)
                   .And
                   .Queryable(queryable2)
                   .Count);
        }
Example #3
0
        public void MultipleInstances()
        {
            var firstResult = this.everyThing
                              .Search()
                              .Name
                              .Contains("IImageQueryable.cs");

            IEverything secondEverything = new Everything();
            var         secondResult     = secondEverything
                                           .Search()
                                           .Name
                                           .Contains("IMusicQueryable.cs");

            Assert.That(firstResult.First().FileName, Is.EqualTo("IImageQueryable.cs"));
            Assert.That(secondResult.First().FileName, Is.EqualTo("IMusicQueryable.cs"));
        }
Example #4
0
    static void Main(string[] args)
    {
        Console.WriteLine("Enter your search query:");
        var qry     = Console.ReadLine();
        var results = Everything.Search(qry);

        var resultCount = 0;

        foreach (var result in results)
        {
            resultCount++;
            if (resultCount > MAX_RESULTS)
            {
                break;
            }

            Console.WriteLine($"{resultCount:D2}. {result.ToString()}");
        }
    }