Search for string in record contents and return array of Record objects
(params, searchstring)
| 486 | |
| 487 | |
| 488 | def search_records(params, searchstring): |
| 489 | """Search for string in record contents |
| 490 | and return array of Record objects """ |
| 491 | |
| 492 | p = re.compile(searchstring.lower()) |
| 493 | search_results = [] |
| 494 | |
| 495 | for record_uid in params.record_cache: |
| 496 | rec = get_record(params, record_uid) |
| 497 | if not rec: |
| 498 | continue |
| 499 | cached_rec = params.record_cache[record_uid] or {} |
| 500 | |
| 501 | if cached_rec.get('version') == 3: |
| 502 | data = cached_rec.get('data_unencrypted') |
| 503 | rec.record_type = RecordV3.get_record_type_name(data) |
| 504 | target = RecordV3.values_to_lowerstring(data) |
| 505 | else: |
| 506 | target = rec.to_lowerstring() |
| 507 | |
| 508 | if p.search(target): |
| 509 | search_results.append(rec) |
| 510 | |
| 511 | return search_results |
| 512 | |
| 513 | |
| 514 | def search_shared_folders(params, searchstring, use_regex=False): |
nothing calls this directly
no test coverage detected