lib_search
Search open .SchLib files and installed database libraries to find components by name, description, or parameters.
Instructions
Search open SchLib documents and installed database libraries.
OPEN .SchLib FILES AND INSTALLED DATABASE LIBRARIES (DbLib) ARE
SEARCHED. Query libraries (SVN DbLib), integrated libraries
(IntLib), workspace components and installed .SchLib files that
are not open are not, so 0 hits is not "no such part". The reply
says what was searched (libraries_searched, DbLibs included)
and lists every installed library it could not read
(not_searched, with the reason), with a coverage_note when
anything was skipped.
DbLib rows join results after the SchLib matches, with what
is left of limit, each marked source: "dblib" and carrying
its table, key, symbol and footprints; SchLib matches are marked
source: "schlib". Every column of a row is matched, so a
manufacturer part number or a value finds the part. A DbLib that
cannot be connected stays under not_searched with the reason,
and dblib_searches says what each DbLib search covered. Use
lib_dblib_search to restrict to one table or a few columns,
and lib_dblib_get_record for every column of one row.
Case-insensitive substring match. Walks every .SchLib that is
a member of any open project, plus every standalone .SchLib in
the workspace's free-documents area. Each library is read via
CreateLibCompInfoReader so the search is fast even with
many libraries open: it only loads symbols when search_type
is "parameters".
IT READS THE FILE ON DISK, NOT THE EDITOR. A component created
in this session and not yet saved WILL NOT BE FOUND, and the
reply is an ordinary empty result with nothing to say why.
MEASURED: a symbol that lib_get_component_details returned
in full was absent here until a save. Save first, or use
lib_get_component_details / lib_get_pin_list, which read
the live document.
DATASHEET DISCIPLINE: Matches carry _datasheet_guidance.
Before recommending any matched part as a replacement or
answer, fetch its datasheet (WebSearch + WebFetch). Do not
recommend based on symbol metadata alone.
Args:
query: Substring to match against component name / alias /
description (case-insensitive).
search_type: "all" (default, matches name / alias /
description), "name", "description", or
"parameters" (slow, also walks each candidate's
parameter dict via the live symbol).
library_path: Optional path to a single .SchLib, or to a
single .DbLib, to restrict the search to. When omitted,
searches every open .SchLib and every installed DbLib.
limit: Cap on returned matches (default 100), SchLib and
DbLib together.
include_dblibs: also search the installed database libraries
(default True). Their rows are read through the connection
each DbLib declares, every row of every enabled table up to
lib_dblib_search's row bound, so a large database makes the
search slower; False keeps it to open .SchLib files and
lists the DbLibs under not_searched. A library_path
naming a .DbLib searches that one either way.
Returns:
Dict with query, search_type, count, limit,
truncated (True when count == limit, or when a DbLib
search stopped early), and results, a list of {name,
alias_name, description, library_path, part_count, source}
per match (a DbLib row adds table, key_field, symbol_ref,
symbol_library, footprints, matched_field, and its name is
the row's key), plus _datasheet_guidance +
_datasheet_parts; and libraries_searched,
not_searched (each {library_path, library_type, reason}), dblib_searches and coverage_note as
above. Either list is None when it could not be read.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| query | Yes | ||
| search_type | No | all | |
| library_path | No | ||
| include_dblibs | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||