module NNTP::Connection::Search

Direct including types

Defined in:

nntp/connection/search.cr

Instance Method Summary

Instance Method Detail

def find_article_num(message_id : String, group : String | Nil = nil, batch_size = 100, offset : Int64 | Nil = nil) #

Search for the provided message_id in the provided group. Will return a Int64 indicating the article number in the group if found. batch_size determines the amount of articles to query at a time, while offset determines the article start position. If nil offset will default to the first article in group.

# Start searching at article 1958260 and query 2000 at a time
client.find_article_num(
  message_id: "[email protected]",
  group: "alt.binaries.tun",
  batch_size: 2000,
  offset: 1958260_i64
) # => 1958270

client.with_group "alt.binaries.tun" do
  client.find_article_num(
    message_id: "[email protected]",
    batch_size: 2000,
    offset: 1958260_i64
  ) # => 1958270
end

[View source]
def search_for_header(header : String, value : String, group : String | Nil = nil, batch_size = 100, offset : Int64 | Nil = nil, exact = false) #

Search for the first article with the value within the specified header. This will simply search for the substring within the header of each article and return the first match. If exact is true it will attempt to match the entire header value.

group can be ommited if used within a with_group block. If the current context does not have a group a NNTP::Error::NoGroupContext error will be raised.

batch_size determines the amount of articles to query at a time, while offset determines the article start position. If nil offset will default to the first article in group.


[View source]