Method: Wgit::DSL#index_site
- Defined in:
- lib/wgit/dsl.rb
#index_site(*urls, insert_externals: false, follow: @dsl_follow, allow_paths: nil, disallow_paths: nil) {|doc| ... } ⇒ Integer Also known as: index_r
Indexes a single website using Wgit::Indexer#index_site underneath.
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/wgit/dsl.rb', line 208 def index_site( *urls, insert_externals: false, follow: @dsl_follow, allow_paths: nil, disallow_paths: nil, &block ) urls = (@dsl_start || []) if urls.empty? raise DSL_ERROR__NO_START_URL if urls.empty? indexer = Wgit::Indexer.new(get_db, get_crawler) xpath = follow || :default crawl_opts = { insert_externals:, follow: xpath, allow_paths:, disallow_paths: } urls.reduce(0) do |total, url| total + indexer.index_site(Wgit::Url.parse(url), **crawl_opts, &block) end end |