nikeshn commited on
Commit
35f7d12
·
verified ·
1 Parent(s): c5943f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -2516,13 +2516,21 @@ async def agent_query(req: AgentRequest):
2516
  combined = synthesis_pool + [r for r in combined if r not in synthesis_pool]
2517
  else:
2518
  from urllib.parse import quote as _quote
 
 
 
 
 
 
 
 
 
2519
  answer = (
2520
  "I searched PRIMO for literature on this topic but couldn't retrieve "
2521
  "records with enough metadata for a synthesis right now. "
2522
- "Try searching directly: "
2523
- f"<a href='https://khalifa.primo.exlibrisgroup.com/discovery/search?"
2524
- f"query=any,contains,{_quote(database_query)}&vid=971KUOSTAR_INST:KU' target='_blank'>"
2525
- f"Search PRIMO</a> — or use the AI tools below for deeper discovery."
2526
  )
2527
 
2528
  else:
 
2516
  combined = synthesis_pool + [r for r in combined if r not in synthesis_pool]
2517
  else:
2518
  from urllib.parse import quote as _quote
2519
+ # Use the Boolean query in PRIMO advanced search — same format as the frontend buildSearchCard
2520
+ # URL format: query=any,contains,{encoded_boolean},AND&tab=Everything&search_scope=MyInst_and_CI&mode=advanced
2521
+ _bool = search_plan.get("boolean") or database_query
2522
+ _primo_url = (
2523
+ "https://khalifa.primo.exlibrisgroup.com/discovery/search"
2524
+ + "?query=any,contains," + _quote(_bool) + ",AND"
2525
+ + "&tab=Everything&search_scope=MyInst_and_CI"
2526
+ + "&vid=971KUOSTAR_INST:KU&lang=en&mode=advanced&offset=0"
2527
+ )
2528
  answer = (
2529
  "I searched PRIMO for literature on this topic but couldn't retrieve "
2530
  "records with enough metadata for a synthesis right now. "
2531
+ "Try the Boolean search directly in PRIMO: "
2532
+ '<a href="' + _primo_url + '" target="_blank">Search PRIMO (Advanced)</a>'
2533
+ " — or use the AI tools below for deeper discovery."
 
2534
  )
2535
 
2536
  else: