leo-bourrel commited on
Commit
bf1521f
·
1 Parent(s): 7eaf36c

feat: handle splitted fr/en abstract & title

Browse files
Files changed (1) hide show
  1. custom_pgvector.py +4 -4
custom_pgvector.py CHANGED
@@ -343,18 +343,18 @@ class CustomPGVector(VectorStore):
343
  f"""
344
  select
345
  a.id,
346
- a.title,
347
  a.doi,
348
- a.abstract,
349
  string_agg(distinct keyword."name", ',') as keywords,
350
  string_agg(distinct author."name", ',') as authors,
351
- abstract_embedding <-> '{str(embedding)}' as distance
352
  from article a
353
  left join article_keyword ON article_keyword.article_id = a.id
354
  left join keyword on article_keyword.keyword_id = keyword.id
355
  left join article_author ON article_author.article_id = a.id
356
  left join author on author.id = article_author.author_id
357
- where abstract != 'NaN'
358
  GROUP BY a.id
359
  ORDER BY distance
360
  LIMIT {k};
 
343
  f"""
344
  select
345
  a.id,
346
+ a.title_en,
347
  a.doi,
348
+ a.abstract_en,
349
  string_agg(distinct keyword."name", ',') as keywords,
350
  string_agg(distinct author."name", ',') as authors,
351
+ abstract_embedding_en <-> '{str(embedding)}' as distance
352
  from article a
353
  left join article_keyword ON article_keyword.article_id = a.id
354
  left join keyword on article_keyword.keyword_id = keyword.id
355
  left join article_author ON article_author.article_id = a.id
356
  left join author on author.id = article_author.author_id
357
+ where abstract_en != ''
358
  GROUP BY a.id
359
  ORDER BY distance
360
  LIMIT {k};