Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# Sample search using json with pandas
def json_search(query):
matches = movies_df[movies_df['title'].str.lower().str.contains(query.lower()) | movies_df['original_title'].str.lower().str.contains(query.lower())]
matches_filtered = matches[['title', 'overview', 'vote_average', 'reviews']] # Adjusted to match relevant fields in the new JSON
matches_filtered = matches[['title', 'overview', 'vote_average', 'reviews','image','popularity']] # Adjusted to match relevant fields in the new JSON
matches_filtered_json = matches_filtered.to_json(orient='records')
return matches_filtered_json
def genre_search(genre):
Expand All @@ -59,7 +59,7 @@ def is_genre_present(genres_str, genre):
return False

matches = movies_df[movies_df['genres'].apply(lambda g: is_genre_present(g, genre))]
matches_filtered = matches[['title', 'overview', 'vote_average','reviews']]
matches_filtered = matches[['title', 'overview', 'vote_average', 'reviews','image','popularity']]
matches_filtered_json = matches_filtered.to_json(orient='records')
return matches_filtered_json

Expand Down
6 changes: 6 additions & 0 deletions backend/checkjson.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import json

with open('init.json', 'r') as file:
data = json.load(file)
for item in data:
print(item['popularity'], item['image'])