@@ -120,7 +120,6 @@ defmodule Manavault.Catalog.Scryfall.Import do
120120 fn ->
121121 insert_card_rows ( rows . cards , replace_oracle_tag_fields? )
122122 insert_printing_rows ( rows . printings )
123- refresh_printing_search_rows ( rows . search_rows )
124123 { :ok , :imported }
125124 end ,
126125 timeout: :infinity
@@ -132,7 +131,6 @@ defmodule Manavault.Catalog.Scryfall.Import do
132131 source_count: 0 ,
133132 cards_count: 0 ,
134133 printings_count: 0 ,
135- search_rows_count: 0 ,
136134 next_progress: @ progress_source_card_interval
137135 }
138136 end
@@ -142,8 +140,7 @@ defmodule Manavault.Catalog.Scryfall.Import do
142140 counts
143141 | source_count: counts . source_count + source_count ,
144142 cards_count: counts . cards_count + length ( rows . cards ) ,
145- printings_count: counts . printings_count + length ( rows . printings ) ,
146- search_rows_count: counts . search_rows_count + length ( rows . search_rows )
143+ printings_count: counts . printings_count + length ( rows . printings )
147144 }
148145 end
149146
@@ -212,8 +209,7 @@ defmodule Manavault.Catalog.Scryfall.Import do
212209 when processed >= next or processed == source_count do
213210 Logger . info (
214211 "Scryfall catalog import progress source_cards=#{ processed } /#{ source_count } " <>
215- "cards=#{ counts . cards_count } printings=#{ counts . printings_count } " <>
216- "search_rows=#{ counts . search_rows_count } "
212+ "cards=#{ counts . cards_count } printings=#{ counts . printings_count } "
217213 )
218214
219215 % { counts | next_progress: next_progress_after ( processed ) }
@@ -254,67 +250,6 @@ defmodule Manavault.Catalog.Scryfall.Import do
254250 |> Enum . each ( fn batch -> Repo . insert_all ( schema , batch , opts ) end )
255251 end
256252
257- defp refresh_printing_search_rows ( [ ] ) , do: :ok
258-
259- defp refresh_printing_search_rows ( rows ) do
260- rows
261- |> Enum . map ( & & 1 . scryfall_id )
262- |> Enum . chunk_every ( @ batch_size )
263- |> Enum . each ( fn ids ->
264- placeholders = Enum . map_join ( ids , "," , fn _ -> "?" end )
265-
266- Repo . query! (
267- "DELETE FROM scryfall_printing_search WHERE scryfall_id IN (#{ placeholders } )" ,
268- ids
269- )
270- end )
271-
272- rows
273- |> Enum . chunk_every ( @ batch_size )
274- |> Enum . each ( fn batch ->
275- values = Enum . map_join ( batch , "," , fn _ -> "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" end )
276-
277- params =
278- Enum . flat_map ( batch , fn row ->
279- [
280- row . scryfall_id ,
281- row . name ,
282- row . compact_name ,
283- row . flavor_name ,
284- row . compact_flavor_name ,
285- row . flavor_text ,
286- row . compact_flavor_text ,
287- row . type_line ,
288- row . oracle_text ,
289- row . compact_oracle_text ,
290- row . set_code ,
291- row . collector_number
292- ]
293- end )
294-
295- Repo . query! (
296- """
297- INSERT INTO scryfall_printing_search (
298- scryfall_id,
299- name,
300- compact_name,
301- flavor_name,
302- compact_flavor_name,
303- flavor_text,
304- compact_flavor_text,
305- type_line,
306- oracle_text,
307- compact_oracle_text,
308- set_code,
309- collector_number
310- )
311- VALUES #{ values }
312- """ ,
313- params
314- )
315- end )
316- end
317-
318253 defp maybe_reconcile_printings ( false , _imported_at ) , do: :ok
319254
320255 defp maybe_reconcile_printings ( true , imported_at ) do
@@ -410,8 +345,6 @@ defmodule Manavault.Catalog.Scryfall.Import do
410345 |> Enum . chunk_every ( @ batch_size )
411346 |> Enum . each ( & clear_trade_wants / 1 )
412347
413- delete_printing_search_rows ( stale_ids )
414-
415348 Enum . each ( Enum . chunk_every ( stale_ids , @ batch_size ) , fn ids ->
416349 Repo . delete_all ( from printing in Printing , where: printing . scryfall_id in ^ ids )
417350 end )
@@ -541,19 +474,6 @@ defmodule Manavault.Catalog.Scryfall.Import do
541474 end )
542475 end
543476
544- defp delete_printing_search_rows ( [ ] ) , do: :ok
545-
546- defp delete_printing_search_rows ( ids ) do
547- Enum . each ( Enum . chunk_every ( ids , @ batch_size ) , fn batch ->
548- placeholders = Enum . map_join ( batch , "," , fn _ -> "?" end )
549-
550- Repo . query! (
551- "DELETE FROM scryfall_printing_search WHERE scryfall_id IN (#{ placeholders } )" ,
552- batch
553- )
554- end )
555- end
556-
557477 defp import_timestamp ( false ) , do: utc_now ( )
558478
559479 defp import_timestamp ( true ) do
0 commit comments