astronolan commited on
Commit
77db51c
·
1 Parent(s): a80774c

Update search examples

Browse files
Files changed (2) hide show
  1. src/callbacks.py +13 -5
  2. src/components.py +2 -2
src/callbacks.py CHANGED
@@ -169,14 +169,14 @@ def register_callbacks(app, search_service: SearchService):
169
  [Input("example-1", "n_clicks"),
170
  Input("example-2", "n_clicks"),
171
  Input("example-3", "n_clicks"),
 
172
  Input("example-5", "n_clicks"),
173
  Input("example-6", "n_clicks"),
174
- Input("example-7", "n_clicks"),
175
  Input("example-8", "n_clicks")],
176
  [State("search-button", "n_clicks")],
177
  prevent_initial_call=True
178
  )
179
- def trigger_search_from_examples(click1, click2, click3, click5, click6, click7, click8, current_clicks):
180
  """Trigger search when example buttons are clicked."""
181
  ctx = callback_context
182
  if not ctx.triggered:
@@ -186,11 +186,11 @@ def register_callbacks(app, search_service: SearchService):
186
 
187
  example_queries = {
188
  "example-1": "Two edge-on galaxies",
189
- "example-2": "A peculiar interacting galaxy system featuring plenty of tidal tails and a disturbed morphology",
190
  "example-3": "galaxy with stream",
 
191
  "example-5": "A violent merger in progress with visible tidal features",
192
  "example-6": "Low surface brightness",
193
- "example-7": "A face-on spiral with ring-like circular structure around a core",
194
  "example-8": "a bursty, star forming galaxy"
195
  }
196
 
@@ -260,6 +260,14 @@ def register_callbacks(app, search_service: SearchService):
260
  if not query or not query.strip():
261
  return "", dbc.Alert("Please enter a search query", color="warning"), None, True, True, None
262
 
 
 
 
 
 
 
 
 
263
  # Generate unique request_id for this search
264
  request_id = uuid.uuid4().hex
265
 
@@ -327,7 +335,7 @@ def register_callbacks(app, search_service: SearchService):
327
  "rmag_max": rmag_max
328
  }
329
 
330
- return "", results_container, search_data, False, False, search_params
331
 
332
  except Exception as e:
333
  error_msg = dbc.Alert(f"Search failed: {str(e)}", color="danger")
 
169
  [Input("example-1", "n_clicks"),
170
  Input("example-2", "n_clicks"),
171
  Input("example-3", "n_clicks"),
172
+ Input("example-4", "n_clicks"),
173
  Input("example-5", "n_clicks"),
174
  Input("example-6", "n_clicks"),
 
175
  Input("example-8", "n_clicks")],
176
  [State("search-button", "n_clicks")],
177
  prevent_initial_call=True
178
  )
179
+ def trigger_search_from_examples(click1, click2, click3, click4, click5, click6, click8, current_clicks):
180
  """Trigger search when example buttons are clicked."""
181
  ctx = callback_context
182
  if not ctx.triggered:
 
186
 
187
  example_queries = {
188
  "example-1": "Two edge-on galaxies",
189
+ "example-2": "Interacting galaxies with tidal tails",
190
  "example-3": "galaxy with stream",
191
+ "example-4": "galaxy with spiral arms",
192
  "example-5": "A violent merger in progress with visible tidal features",
193
  "example-6": "Low surface brightness",
 
194
  "example-8": "a bursty, star forming galaxy"
195
  }
196
 
 
260
  if not query or not query.strip():
261
  return "", dbc.Alert("Please enter a search query", color="warning"), None, True, True, None
262
 
263
+ hint = ""
264
+ if query.strip().casefold() == "spiral galaxy":
265
+ hint = dbc.Alert(
266
+ 'you might want to try "galaxy with spiral arms"',
267
+ color="warning",
268
+ className="mb-3 text-center"
269
+ )
270
+
271
  # Generate unique request_id for this search
272
  request_id = uuid.uuid4().hex
273
 
 
335
  "rmag_max": rmag_max
336
  }
337
 
338
+ return hint, results_container, search_data, False, False, search_params
339
 
340
  except Exception as e:
341
  error_msg = dbc.Alert(f"Search failed: {str(e)}", color="danger")
src/components.py CHANGED
@@ -581,12 +581,12 @@ def create_search_container():
581
  id="example-2", className="example-button me-2 mb-2", size="sm", color="light"),
582
  dbc.Button([html.I(className="fas fa-stream me-2"), "Stream"],
583
  id="example-3", className="example-button me-2 mb-2", size="sm", color="light"),
 
 
584
  dbc.Button([html.I(className="fas fa-explosion me-2"), "A violent merger"],
585
  id="example-5", className="example-button me-2 mb-2", size="sm", color="light"),
586
  dbc.Button([html.I(className="fas fa-moon me-2"), "Low surface brightness"],
587
  id="example-6", className="example-button me-2 mb-2", size="sm", color="light"),
588
- dbc.Button([html.I(className="fas fa-ring me-2"), "Ring-like structure"],
589
- id="example-7", className="example-button me-2 mb-2", size="sm", color="light"),
590
  dbc.Button([html.I(className="fas fa-star me-2"), "A bursty, star forming galaxy"],
591
  id="example-8", className="example-button mb-2", size="sm", color="light")
592
  ], className="text-center")
 
581
  id="example-2", className="example-button me-2 mb-2", size="sm", color="light"),
582
  dbc.Button([html.I(className="fas fa-stream me-2"), "Stream"],
583
  id="example-3", className="example-button me-2 mb-2", size="sm", color="light"),
584
+ dbc.Button([html.I(className="fas fa-hurricane me-2"), "Spiral Galaxy"],
585
+ id="example-4", className="example-button me-2 mb-2", size="sm", color="light"),
586
  dbc.Button([html.I(className="fas fa-explosion me-2"), "A violent merger"],
587
  id="example-5", className="example-button me-2 mb-2", size="sm", color="light"),
588
  dbc.Button([html.I(className="fas fa-moon me-2"), "Low surface brightness"],
589
  id="example-6", className="example-button me-2 mb-2", size="sm", color="light"),
 
 
590
  dbc.Button([html.I(className="fas fa-star me-2"), "A bursty, star forming galaxy"],
591
  id="example-8", className="example-button mb-2", size="sm", color="light")
592
  ], className="text-center")