private List<ICompiledTextSearchContainer> CreateSearchAlgorithms(
   ParsedSearchString parsedSearchString, SearchProviderOptions options) {
   return parsedSearchString.EntriesBeforeMainEntry
     .Concat(new[] { parsedSearchString.MainEntry })
     .Concat(parsedSearchString.EntriesAfterMainEntry)
     .OrderBy(x => x.Index)
     .Select(entry => _compiledTextSearchProviderFactory.CreateProvider(entry.Text, options))
     .ToList();
 }
示例#2
0
 private List <ICompiledTextSearchContainer> CreateSearchAlgorithms(
     ParsedSearchString parsedSearchString, SearchProviderOptions options)
 {
     return(parsedSearchString.EntriesBeforeMainEntry
            .Concat(new[] { parsedSearchString.MainEntry })
            .Concat(parsedSearchString.EntriesAfterMainEntry)
            .OrderBy(x => x.Index)
            .Select(entry => _compiledTextSearchProviderFactory.CreateProvider(entry.Text, options))
            .ToList());
 }
    public PerThreadCompiledTextSearchContainer(string pattern, SearchProviderOptions searchOptions) {
      _pattern = pattern;
      _searchOptions = searchOptions;
      _asciiAlgorithmFactory = x => AsciiFileContents.CreateSearchAlgo(_pattern, _searchOptions);
      _utf16CompiledTextSearchAlgo = Utf16FileContents.CreateSearchAlgo(_pattern, _searchOptions);

      // Force execution on the current thread so that we get an exception if
      // the search engine finds "pattern" is invalid.
      this.GetAsciiSearch();
    }
    public ICompiledTextSearchContainer CreateProvider(
      string pattern,
      SearchProviderOptions searchOptions) {
      // RE2 engine requires a per-thread provider, as the current C++
      // implementation suffers from serious lock contention if a RE2 regex
      // instance is shared accross threads.
      if (searchOptions.UseRegex && searchOptions.UseRe2Engine)
        return new PerThreadCompiledTextSearchContainer(pattern, searchOptions);

      return new CompiledTextSearchContainer(pattern, searchOptions);
    }
        public PerThreadCompiledTextSearchContainer(string pattern, SearchProviderOptions searchOptions)
        {
            _pattern                     = pattern;
            _searchOptions               = searchOptions;
            _asciiAlgorithmFactory       = x => AsciiFileContents.CreateSearchAlgo(_pattern, _searchOptions);
            _utf16CompiledTextSearchAlgo = Utf16FileContents.CreateSearchAlgo(_pattern, _searchOptions);

            // Force execution on the current thread so that we get an exception if
            // the search engine finds "pattern" is invalid.
            this.GetAsciiSearch();
        }
示例#6
0
 public static CompiledTextSearchBase CreateSearchAlgo(
     string pattern,
     SearchProviderOptions searchOptions) {
   var options = NativeMethods.SearchOptions.kNone;
   if (searchOptions.MatchCase) {
     options |= NativeMethods.SearchOptions.kMatchCase;
   }
   if (searchOptions.MatchWholeWord) {
     options |= NativeMethods.SearchOptions.kMatchWholeWord;
   }
   return new Utf16CompiledTextSearchStdSearch(pattern, options);
 }
示例#7
0
        public ICompiledTextSearchContainer CreateProvider(
            string pattern,
            SearchProviderOptions searchOptions)
        {
            // RE2 engine requires a per-thread provider, as the current C++
            // implementation suffers from serious lock contention if a RE2 regex
            // instance is shared accross threads.
            if (searchOptions.UseRegex && searchOptions.UseRe2Engine)
            {
                return(new PerThreadCompiledTextSearchContainer(pattern, searchOptions));
            }

            return(new CompiledTextSearchContainer(pattern, searchOptions));
        }
示例#8
0
    public static ICompiledTextSearch CreateSearchAlgo(string pattern, SearchProviderOptions searchOptions) {
      var options = NativeMethods.SearchOptions.kNone;
      if (searchOptions.MatchCase) {
        options |= NativeMethods.SearchOptions.kMatchCase;
      }
      if (searchOptions.MatchWholeWord) {
        options |= NativeMethods.SearchOptions.kMatchWholeWord;
      }

      if (searchOptions.UseRegex && searchOptions.UseRe2Engine)
        return new AsciiCompiledTextSearchRe2(pattern, options);

      if (searchOptions.UseRegex)
        return new AsciiCompiledTextSearchRegex(pattern, options);

      if (pattern.Length <= 64)
        return new AsciiCompiledTextSearchBndm64(pattern, options);

      return new AsciiCompiledTextSearchBoyerMoore(pattern, options);
    }
 public CompiledTextSearchContainer(string pattern, SearchProviderOptions searchOptions)
 {
     _asciiCompiledTextSearchAlgo = AsciiFileContents.CreateSearchAlgo(pattern, searchOptions);
     _utf16CompiledTextSearchAlgo = Utf16FileContents.CreateSearchAlgo(pattern, searchOptions);
 }
 public CompiledTextSearchContainer(string pattern, SearchProviderOptions searchOptions) {
   _asciiCompiledTextSearchAlgo = AsciiFileContents.CreateSearchAlgo(pattern, searchOptions);
   _utf16CompiledTextSearchAlgo = Utf16FileContents.CreateSearchAlgo(pattern, searchOptions);
 }