<commit_before>module Riddle
  class Controller
    attr_accessor :path, :bin_path, :searchd_binary_name, :indexer_binary_name
    
    def initialize(configuration, path)
      @configuration  = configuration
      @path           = path
      
      @bin_path            = ''
      @searchd_binary_name = 'searchd'
      @indexer_binary_name = 'indexer'
    end
    
    def sphinx_version
      `#{indexer} 2>&1`[/^Sphinx (\d+\.\d+(\.\d+|(?:-dev|(\-id64)?\-beta)))/, 1]
    rescue
      nil
    end
    
    def index(*indexes)
      options = indexes.last.is_a?(Hash) ? indexes.pop : {}
      indexes << '--all' if indexes.empty?
      
      cmd = "#{indexer} --config \"#{@path}\" #{indexes.join(' ')}"
      cmd << " --rotate" if running?
      options[:verbose] ? system(cmd) : `#{cmd}`
    end
    
    def start
      return if running?
      check_for_configuration_file
      
      cmd = "#{searchd} --pidfile --config \"#{@path}\""
      
      if RUBY_PLATFORM =~ /mswin/
        system("start /B #{cmd} 1> NUL 2>&1")
      else
        `#{cmd}`
      end
      
      sleep(1)
      
      unless running?<commit_msg>get the sphinx version in coreseek.<commit_after>module Riddle
  class Controller
    attr_accessor :path, :bin_path, :searchd_binary_name, :indexer_binary_name
    
    def initialize(configuration, path)
      @configuration  = configuration
      @path           = path
      
      @bin_path            = ''
      @searchd_binary_name = 'searchd'
      @indexer_binary_name = 'indexer'
    end
    
    def sphinx_version
      `#{indexer} 2>&1`[/Sphinx (\d+\.\d+(\.\d+|(?:-dev|(\-id64)?\-beta)))/, 1]
    rescue
      nil
    end
    
    def index(*indexes)
      options = indexes.last.is_a?(Hash) ? indexes.pop : {}
      indexes << '--all' if indexes.empty?
      
      cmd = "#{indexer} --config \"#{@path}\" #{indexes.join(' ')}"
      cmd << " --rotate" if running?
      options[:verbose] ? system(cmd) : `#{cmd}`
    end
    
    def start
      return if running?
      check_for_configuration_file
      
      cmd = "#{searchd} --pidfile --config \"#{@path}\""
      
      if RUBY_PLATFORM =~ /mswin/
        system("start /B #{cmd} 1> NUL 2>&1")
      else
        `#{cmd}`
      end
      
      sleep(1)
      
      unless running?
{'fraction_non_alphanumeric': 0.15478793178836905, 'fraction_numerical': 0.007870572802798426, 'mean_word_length': 1.899873257287706, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6115105', 'n_tokens_mistral': 786, 'n_tokens_neox': 780, 'n_words': 162}