Search Operator (Serper)
Overview
Section titled “Overview”The Search LOP acts as an interface to the Serper.dev Google Search API, enabling various search types directly within TouchDesigner. It can perform standard web searches, image searches, video searches, academic searches (Scholar), patent lookups, shopping results, map queries, business reviews, and even provide autocomplete suggestions. Results are fetched asynchronously and stored internally, with options to parse specific result types into dedicated output DATs.
Requirements
Section titled “Requirements”- Serper API Key: Obtain an API key from Serper.dev and enter it into the
Serper API Key
parameter on the ‘API Key’ page. - ChatTD Operator: Required for asynchronous task execution and logging. Ensure the
ChatTD Operator
parameter on the ‘About’ page points to your configured ChatTD instance. - Standard Python Libraries: Uses the built-in
requests
library for API calls (no special external Python packages needed).
Input/Output
Section titled “Input/Output”Inputs
Section titled “Inputs”None (Search queries and parameters are configured via the operator’s parameters).
Outputs
Section titled “Outputs”- Internal
results_table
DAT: Stores the raw JSON response for every search performed. Columns:query_id
,query
,type
,result
(JSON string),timestamp
. - Internal
query_table
DAT: Logs basic information about each query attempt. Columns:query_id
,status
,timestamp
. - Formatted Output DATs (selected via
Output DAT
parameter): These DATs parse specific sections of the raw JSON result from theresults_table
into structured tables:search_results
: Standard web search results (title, link, snippet, etc.).search_related
: Related search queries.search_map_results
: Results from a Map search.search_shopping
: Shopping results.search_info
: General information about the search query. (Note: The exact structure and availability of these tables depend on theSearch Type
used and the data returned by the Serper API for that query.)
- Viewer TOP (
image_viewer
): When theView
parameter is set toimage_view
, displays the image corresponding to the result selected by theSelect Result Index
parameter (primarily useful for Image searches).
Parameters
Section titled “Parameters”Page: Serper
Section titled “Page: Serper” Search Query (Query)
op('search').par.Query
Str - Default:
None
Execute Search (Search)
op('search').par.Search
Pulse - Default:
None
Clear Results (Clear)
op('search').par.Clear
Pulse - Default:
None
Current Status (Status)
op('search').par.Status
String - Default:
Ready
Select Result Index (Selectresult)
op('search').par.Selectresult
Int - Default:
1
- Range:
- 1 to N/A
- Slider Range:
- 1 to N/A
Auto-select Last Result (Autosetselect)
op('search').par.Autosetselect
Toggle - Default:
On
Location (Location)
op('search').par.Location
Str - Default:
None
GPS Coordinates (@lat,long,zoom) (Gpscoords)
op('search').par.Gpscoords
Str - Default:
None
Place ID (Placeid)
op('search').par.Placeid
Str - Default:
None
Customer ID (CID) (Cid)
op('search').par.Cid
Str - Default:
None
Number of Results (Numresults)
op('search').par.Numresults
Int - Default:
10
- Range:
- 1 to N/A
- Slider Range:
- 1 to 100
Page Number (Page)
op('search').par.Page
Int - Default:
1
- Range:
- 1 to N/A
- Slider Range:
- 1 to 10
Enable Autocorrect (Autocorrect)
op('search').par.Autocorrect
Toggle - Default:
On
Page: API Key
Section titled “Page: API Key” Serper API Key (Apikey)
op('search').par.Apikey
Str - Default:
API KEY LOADED
Get API Key (Getapikey)
op('search').par.Getapikey
Pulse - Default:
None
Page: About
Section titled “Page: About” Bypass (Bypass)
op('search').par.Bypass
Toggle - Default:
Off
Show Built-in Parameters (Showbuiltin)
op('search').par.Showbuiltin
Toggle - Default:
Off
Version (Version)
op('search').par.Version
String - Default:
1.0.0
Last Updated (Lastupdated)
op('search').par.Lastupdated
String - Default:
2024-11-10
Creator (Creator)
op('search').par.Creator
String - Default:
dotsimulate
Website (Website)
op('search').par.Website
String - Default:
https://dotsimulate.com
ChatTD Operator (Chattd)
op('search').par.Chattd
OP - Default:
/dot_lops/ChatTD
Usage Examples
Section titled “Usage Examples”Basic Image Search
Section titled “Basic Image Search”1. Enter your Serper API Key on the 'API Key' page.2. On the 'Serper' page, set 'Search Type' to 'Images'.3. Enter your query in 'Search Query' (e.g., "abstract generative art").4. Set 'Number of Results' (e.g., 20).5. Pulse 'Execute Search'.6. Set 'View' to 'image_view'.7. Use 'Select Result Index' to browse the fetched images in the operator viewer.
Web Search for Recent News
Section titled “Web Search for Recent News”1. Ensure API Key is set.2. Set 'Search Type' to 'Web Search'.3. Enter query (e.g., "latest AI developments").4. Set 'Time Filter' to 'Past week'.5. Set 'Country' and 'Language' as needed.6. Pulse 'Execute Search'.7. Set 'View' to 'output_dat'.8. Set 'Output DAT' to 'search_results' to view standard results or 'search_related' for related queries.
Finding Local Businesses (Maps Search)
Section titled “Finding Local Businesses (Maps Search)”1. Ensure API Key is set.2. Set 'Search Type' to 'Maps'.3. Enter query (e.g., "coffee shops").4. Enter a location in 'Location' (e.g., "San Francisco, CA") or precise 'GPS Coordinates'.5. Pulse 'Execute Search'.6. Set 'View' to 'output_dat'.7. Set 'Output DAT' to 'search_map_results' to see the parsed map results.
Technical Notes
Section titled “Technical Notes”- API Key Storage: Your Serper API key is stored securely in a local configuration file (
serper_config.json
) within your system’s ChatTD application data folder. - Asynchronous Operation: Search requests are made asynchronously using ChatTD’s TDAsyncIO, preventing the main TouchDesigner thread from freezing during the web request.
- Result Parsing: The operator parses common fields from the Serper JSON response into specific output DATs based on the
Output DAT
parameter. The raw JSON is always stored in the internalresults_table
for full access. - Rate Limits: Be mindful of the request limits associated with your Serper API key plan.
- Parameter Visibility: Some parameters (like
Time Filter
,GPS Coordinates
,Sort By
) are only enabled when the relevantSearch Type
is selected.
Related Operators
Section titled “Related Operators”- ChatTD: Provides core services like asynchronous task execution and logging required by this operator.