You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/app/main.py
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -474,17 +474,19 @@ def get_unique_repos():
474
474
topics_lower= [t.lower() fortintopics]
475
475
placeholders=",".join(["?"] *len(topics_lower))
476
476
477
-
# Query to get unique repositories that have ANY of the given topics
478
-
# Create a single search pattern that matches any of the topics
479
-
search_pattern='%'+'%'.join(topics_lower) +'%'
480
-
query="""
477
+
# Query to get unique repositories that have ANY of the given topics using exact matching
478
+
conditions= []
479
+
fortopicintopics_lower:
480
+
conditions.append(f"LOWER(t.topics) LIKE '%|{topic}|%' OR LOWER(t.topics) LIKE '{topic}|%' OR LOWER(t.topics) LIKE '%|{topic}' OR LOWER(t.topics) = '{topic}'")
# Create a more flexible search pattern using OR conditions
215
+
# Create exact topic matching conditions
216
216
conditions= []
217
217
fortopicintopics_lower:
218
-
conditions.append(f"LOWER(t.topics) LIKE '%{topic}%'")
218
+
conditions.append(f"LOWER(t.topics) LIKE '%|{topic}|%' OR LOWER(t.topics) LIKE '{topic}|%' OR LOWER(t.topics) LIKE '%|{topic}' OR LOWER(t.topics) = '{topic}'")
# Add each topic as a separate OR condition with exact matching
81
81
conditions= []
82
82
fortopicintopics_lower:
83
-
conditions.append(f"LOWER(t.topics) LIKE '%{topic}%'")
83
+
conditions.append(f"LOWER(t.topics) LIKE '%|{topic}|%' OR LOWER(t.topics) LIKE '{topic}|%' OR LOWER(t.topics) LIKE '%|{topic}' OR LOWER(t.topics) = '{topic}'")
0 commit comments