PMSEARCHTEXTSUGGEST(3)

πŸ’– pmSearchTextSuggest(3) πŸ’–

okay bestie, so this one lives in the Library Functions Manual for PCP, and it's literally the girl who finds you metric and instance names when you start typing and you're like "wait what was it called" 🫢


✨ NAME ✨

pmSearchTextSuggest β€” search for suggestions of metric or instance names using PCP search services πŸŽ€


✨ C SYNOPSIS ✨

#include <pcp/pmwebapi.h>

int pmSearchTextSuggest(pmSearchSettings *settings,
                        pmSearchTextRequest *request, void *arg);

cc ... -lpcp_web

✨ DESCRIPTION ✨

So what this does is run a full-text search for names of metrics or instances β€” the kind of names you'd want for auto-completion, you know, when the little dropdown pops up and saves your whole life 🌸 β€” and it's all specified by request:

  • query β€” the query string that's gonna be used to search. that's the vibe you're throwing at it πŸ’…
  • count β€” limits the number of results. defaults to 10. so if you don't say anything, you get ten, no cap.

This search does prefix matching on entity names using FTS5 prefix indexes. Terms in query get a wildcard appended to them so partial names still match β€” like, ker matches kernel ✨ (yes, that's the actual example, iconic).

Every single entity that gets matched by the request above gets passed to the on_text_result callback that settings provides. so your callback is the main character here, fr fr πŸ’–


✨ DIAGNOSTICS ✨

This function always returns zero on success πŸŽ‰ On failure? It returns a negative PMAPI error code 😭 not me getting a negative number back.


✨ SEE ALSO ✨

pmproxy(1), pmlogger(1), pmsearch(1), pmSearchSetup(3), PMAPI(3) and PMWEBAPI(3) πŸ¦‹


that's the whole page bestie, go forth and suggest some names πŸ’œ

Performance Co-Pilot β€” PCP β€” PMSEARCHTEXTSUGGEST(3) πŸ‘‘

πŸ“¦ where this page comes from