@@ -320,13 +320,25 @@ pub fn home() -> Html {
320
320
}
321
321
None => true ,
322
322
} ;
323
+ let has_nucleons_exact = match nucleons_search {
324
+ Some ( ref term) => {
325
+ mock_data. data . iter ( ) . any ( |entry| entry. nucleons . to_string ( ) == * term)
326
+ }
327
+ None => true ,
328
+ } ;
323
329
let has_reaction_exact = match reaction_search {
324
330
Some ( ref term) => {
325
331
let term_lower = term. to_lowercase ( ) ;
326
332
mock_data. data . iter ( ) . any ( |entry| entry. reaction . to_lowercase ( ) == term_lower)
327
333
}
328
334
None => true ,
329
335
} ;
336
+ let has_mt_exact = match mt_search {
337
+ Some ( ref term) => {
338
+ mock_data. data . iter ( ) . any ( |entry| entry. mt . to_string ( ) == * term)
339
+ }
340
+ None => true ,
341
+ } ;
330
342
let has_library_exact = match library_search {
331
343
Some ( ref term) => {
332
344
let term_lower = term. to_lowercase ( ) ;
@@ -359,7 +371,14 @@ pub fn home() -> Html {
359
371
None => true ,
360
372
} ;
361
373
let nucleons_match = match nucleons_search {
362
- Some ( ref term) => nucleons. to_string ( ) == * term,
374
+ Some ( ref term) => {
375
+ let nucleons_str = nucleons. to_string ( ) ;
376
+ if has_nucleons_exact {
377
+ nucleons_str == * term
378
+ } else {
379
+ nucleons_str. starts_with ( term)
380
+ }
381
+ }
363
382
None => true ,
364
383
} ;
365
384
let reaction_match = match reaction_search {
@@ -375,7 +394,14 @@ pub fn home() -> Html {
375
394
None => true ,
376
395
} ;
377
396
let mt_match = match mt_search {
378
- Some ( ref term) => mt. to_string ( ) == * term,
397
+ Some ( ref term) => {
398
+ let mt_str = mt. to_string ( ) ;
399
+ if has_mt_exact {
400
+ mt_str == * term
401
+ } else {
402
+ mt_str. starts_with ( term)
403
+ }
404
+ }
379
405
None => true ,
380
406
} ;
381
407
let library_match = match library_search {
0 commit comments