Skip to content

Commit

Permalink
patch ratio (#190)
Browse files Browse the repository at this point in the history
* add configurable threshold, default 0.95

* version bump
  • Loading branch information
iPromKnight authored Mar 30, 2024
1 parent c6d4c06 commit cfeee62
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 14 deletions.
14 changes: 7 additions & 7 deletions deployment/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ services:
condition: service_healthy
env_file: stack.env
hostname: knightcrawler-addon
image: gabisonfire/knightcrawler-addon:2.0.13
image: gabisonfire/knightcrawler-addon:2.0.14
labels:
logging: promtail
networks:
Expand All @@ -117,7 +117,7 @@ services:
redis:
condition: service_healthy
env_file: stack.env
image: gabisonfire/knightcrawler-consumer:2.0.13
image: gabisonfire/knightcrawler-consumer:2.0.14
labels:
logging: promtail
networks:
Expand All @@ -138,7 +138,7 @@ services:
redis:
condition: service_healthy
env_file: stack.env
image: gabisonfire/knightcrawler-debrid-collector:2.0.13
image: gabisonfire/knightcrawler-debrid-collector:2.0.14
labels:
logging: promtail
networks:
Expand All @@ -152,7 +152,7 @@ services:
migrator:
condition: service_completed_successfully
env_file: stack.env
image: gabisonfire/knightcrawler-metadata:2.0.13
image: gabisonfire/knightcrawler-metadata:2.0.14
networks:
- knightcrawler-network
restart: "no"
Expand All @@ -163,7 +163,7 @@ services:
postgres:
condition: service_healthy
env_file: stack.env
image: gabisonfire/knightcrawler-migrator:2.0.13
image: gabisonfire/knightcrawler-migrator:2.0.14
networks:
- knightcrawler-network
restart: "no"
Expand All @@ -182,7 +182,7 @@ services:
redis:
condition: service_healthy
env_file: stack.env
image: gabisonfire/knightcrawler-producer:2.0.13
image: gabisonfire/knightcrawler-producer:2.0.14
labels:
logging: promtail
networks:
Expand All @@ -207,7 +207,7 @@ services:
deploy:
replicas: ${QBIT_REPLICAS:-0}
env_file: stack.env
image: gabisonfire/knightcrawler-qbit-collector:2.0.13
image: gabisonfire/knightcrawler-qbit-collector:2.0.14
labels:
logging: promtail
networks:
Expand Down
14 changes: 7 additions & 7 deletions deployment/docker/src/components/knightcrawler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ x-depends: &knightcrawler-app-depends

services:
metadata:
image: gabisonfire/knightcrawler-metadata:2.0.13
image: gabisonfire/knightcrawler-metadata:2.0.14
env_file: ../../.env
networks:
- knightcrawler-network
Expand All @@ -30,7 +30,7 @@ services:
condition: service_completed_successfully

migrator:
image: gabisonfire/knightcrawler-migrator:2.0.13
image: gabisonfire/knightcrawler-migrator:2.0.14
env_file: ../../.env
networks:
- knightcrawler-network
Expand All @@ -40,30 +40,30 @@ services:
condition: service_healthy

addon:
image: gabisonfire/knightcrawler-addon:2.0.13
image: gabisonfire/knightcrawler-addon:2.0.14
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped
hostname: knightcrawler-addon
ports:
- "7000:7000"

consumer:
image: gabisonfire/knightcrawler-consumer:2.0.13
image: gabisonfire/knightcrawler-consumer:2.0.14
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped

debridcollector:
image: gabisonfire/knightcrawler-debrid-collector:2.0.13
image: gabisonfire/knightcrawler-debrid-collector:2.0.14
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped

producer:
image: gabisonfire/knightcrawler-producer:2.0.13
image: gabisonfire/knightcrawler-producer:2.0.14
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped

qbitcollector:
image: gabisonfire/knightcrawler-qbit-collector:2.0.13
image: gabisonfire/knightcrawler-qbit-collector:2.0.14
<<: [*knightcrawler-app, *knightcrawler-app-depends]
restart: unless-stopped
depends_on:
Expand Down
19 changes: 19 additions & 0 deletions src/migrator/migrations/012_imdb_change_ratio.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- Remove the old search function
DROP FUNCTION IF EXISTS search_imdb_meta(TEXT, TEXT, INT, INT);

-- Add the new search function that allows for searching by year with a plus/minus one year range
CREATE OR REPLACE FUNCTION search_imdb_meta(search_term TEXT, category_param TEXT DEFAULT NULL, year_param INT DEFAULT NULL, limit_param INT DEFAULT 10, similarity_threshold REAL DEFAULT 0.95)
RETURNS TABLE(imdb_id character varying(16), title character varying(1000),category character varying(50),year INT, score REAL) AS $$
BEGIN
SET pg_trgm.similarity_threshold = similarity_threshold;
RETURN QUERY
SELECT imdb_metadata.imdb_id, imdb_metadata.title, imdb_metadata.category, imdb_metadata.year, similarity(imdb_metadata.title, search_term) as score
FROM imdb_metadata
WHERE (imdb_metadata.title % search_term)
AND (imdb_metadata.adult = FALSE)
AND (category_param IS NULL OR imdb_metadata.category = category_param)
AND (year_param IS NULL OR imdb_metadata.year BETWEEN year_param - 1 AND year_param + 1)
ORDER BY score DESC
LIMIT limit_param;
END; $$
LANGUAGE plpgsql;

0 comments on commit cfeee62

Please sign in to comment.