Skip to content

Commit

Permalink
Merge pull request #86 from akretion/v4.0.x-fix-empty-url
Browse files Browse the repository at this point in the history
Skip empty url in site map
  • Loading branch information
sebastienbeau authored Jun 11, 2024
2 parents bdae530 + fdb3474 commit f859677
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/shop_invader/services/elastic_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def find_all_products_and_categories

# first search which also returns _scroll_id
result['hits']['hits'].each do |hit|
record = records[hit['_id']] ||= {}
if hit['_source']['url_key']
record = records[hit['_id']] ||= {}
record[locale] = { name: hit['_source']['name'], url: find_route(config['name']).gsub('*', hit['_source']['url_key']) }
end
end
Expand All @@ -59,8 +59,8 @@ def find_all_products_and_categories
# https://www.elastic.co/guide/en/elasticsearch/reference/6.6/search-request-scroll.html
while result = @client.scroll(body: { scroll_id: result['_scroll_id'] }, scroll: '5m') and not result['hits']['hits'].empty? do
result['hits']['hits'].each do |hit|
record = records[hit['_id']] ||= {}
if hit['_source']['url_key']
record = records[hit['_id']] ||= {}
record[locale] = { name: hit['_source']['name'], url: find_route(config['name']).gsub('*', hit['_source']['url_key']) }
end
end
Expand Down

0 comments on commit f859677

Please sign in to comment.