Sha256: efd9cb4e872c1de9da747b30a9fb9c51be8cc4dd78856768dbc960c9250addf2

Contents?: true

Size: 1021 Bytes

Versions: 9

Compression:

Stored size: 1021 Bytes

Contents

# frozen_string_literal: true

Riddle::Client::Versions[:search]  = 0x117
Riddle::Client::Versions[:excerpt] = 0x102

class Riddle::Client
  private
  
  # Generation of the message to send to Sphinx for an excerpts request.
  def excerpts_message(options)
    message = Message.new
    
    message.append [0, excerpt_flags(options)].pack('N2') # 0 = mode
    message.append_string options[:index]
    message.append_string options[:words]
    
    # options
    message.append_string options[:before_match]
    message.append_string options[:after_match]
    message.append_string options[:chunk_separator]
    message.append_ints options[:limit], options[:around]
    message.append_ints options[:limit_passages], options[:limit_words]
    message.append_ints options[:start_passage_id]
    message.append_string options[:html_strip_mode]
    
    if Versions[:excerpt] >= 0x103
      message.append_string options[:passage_boundary]
    end
    
    message.append_array options[:docs]
    
    message.to_s
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
riddle-2.4.3 lib/riddle/1.10/client.rb
riddle-2.4.2 lib/riddle/1.10/client.rb
riddle-2.4.1 lib/riddle/1.10/client.rb
riddle-2.4.0 lib/riddle/1.10/client.rb
riddle-2.3.2 lib/riddle/1.10/client.rb
riddle-2.3.1 lib/riddle/1.10/client.rb
riddle-2.3.0 lib/riddle/1.10/client.rb
riddle-2.2.2 lib/riddle/1.10/client.rb
riddle-2.2.1 lib/riddle/1.10/client.rb