/v1/search: expose a relevance score; default order ranks by repo popularity
Proposal
Add a per-row relevance (or similarity) score to /v1/search keyword-mode responses so a
caller can re-rank results without a second request.
Today the response carries no relevance signal at all, and the default ordering
(mode=keyword, sort_by=stars, sort_order=desc) sorts by stars — which, as documented after
#36, is the source repository's star count at collection time. A repo-level constant cannot say
which of two matches actually fits the query, so rank #1 currently means "contained in a large
repository," not "best skill."
I am filing this as a proposed behavior change, not a bug report: #36 documented what stars
means, so the current ordering is deliberate. The gap is that a caller has nothing to re-rank on.
Evidence (5 unauthenticated keyword queries, API 1.2.0, default parameters)
| Query | #1 result | #1 source repo | stars | On-topic? |
|---|---|---|---|---|
pdf form filling |
nutrient-document-processing | affaan-m/everything-claude-code | 128071 | partly |
csv quality |
quality-nonconformance | affaan-m/everything-claude-code | 128071 | wrong domain (manufacturing QC) |
docker patterns |
docker-patterns | affaan-m/everything-claude-code | 185402 | yes |
prompt injection |
llm-trading-agent-security | affaan-m/everything-claude-code | 151086 | off-topic (niche trading security) |
postgres migrations |
database-migrations | affaan-m/everything-claude-code | 128071 | yes |
- Ordering was strictly star-descending in 5/5 queries (checked programmatically).
- One repository held rank #1 in 5/5 queries and 12 of the 50 returned top-10 rows; the next-largest contributor held 6/50.
- Response row keys are exactly
author, category, evaluation, repo_name, skill_dir, skill_name, skill_url, stars— no relevance/score field, in eitherkeywordorvectormode. pdf form fillingreturned the same skill twice from the same repository, distinguished only byskill_dir(noted becauserepo_namealone is not a sufficient grouping key).
curl -s "http://api-skillnet.openkg.cn/v1/search?q=csv%20quality&mode=keyword&limit=10"
curl -s "http://api-skillnet.openkg.cn/v1/search?q=prompt%20injection&mode=keyword&limit=10"
import json, urllib.request, urllib.parse
u = "http://api-skillnet.openkg.cn/v1/search?" + urllib.parse.urlencode(
{"q": "csv quality", "mode": "keyword", "limit": 10})
rows = json.load(urllib.request.urlopen(u))["data"]
stars = [r["stars"] for r in rows]
print(all(stars[i] >= stars[i+1] for i in range(len(stars)-1))) # -> True
print(sorted(rows[0].keys())) # no relevance/score key
Alternatives considered
- Minimal (preferred): add a per-row relevance/similarity value to the response. Purely additive and backward-compatible; no default changes.
- Default to relevance for
keywordmode, keepingstarsas an explicitsort_byand as amin_starsfilter. Star order then becomes a tiebreaker or filter, which is a reasonable role for a repo-level constant — it is the primary sort key that is questionable here.
Adjacent issues
- #36 (closed) — duplicate rows; resolved by adding
repo_name/skill_dirand documenting star semantics. Its item 3 noted star-ordered ranking but was not filed; this is that follow-up. - #28 / #31 (closed) — earlier 502 reports; unrelated.
Acceptance criteria
- A
keyword-mode row includes a per-row query-relevance value — or the docs state plainly that star-order is intended and recommendmode=vectorfor semantic ranking. - For the queries above, the top result is on-topic, or the ordering is documented so a caller does not read rank #1 as "best fit."
Environment
/v1/searchonapi-skillnet.openkg.cn, API1.2.0, unauthenticated, no LLM key.- Read against
zjunlp/SkillNet@c5271360115f0a1a4c4a6cae9dd639c7d278a00f;skillnet-ai0.1.3. - All reproduction via
curl/ stdliburllib; no SDK install.
Footnote: the SDK's searcher.py:31 sets sort_by="stars" as its default too, and does not
expose the API's sort_order parameter — a separate, minor API-surface gap worth a line in the
docs, not this report.
Thanks for the detailed proposal and examples. Keyword search currently defaults to repository star count, so its ordering should not be interpreted as query relevance.
For semantic relevance ranking today, please use /v1/search with mode=vector. Results are ordered by embedding similarity.
We're working on a BM25-based update to keyword search, aiming to make relevance the default while retaining star-based sorting and filtering. We'll update this issue as development and validation progress.
Thanks for your patience. The BM25 keyword-search update is now live on the public API and both websites.
/v1/searchkeyword results now includerelevance_score, based on skill names, descriptions, and tags.- Keyword search defaults to
sort_by=relevance. Explicitstars/recentsorting andmin_starsfiltering remain available. - Scores reflect lexical relevance within a query.
mode=vectorremains available for semantic ranking.
We rechecked all five example queries against the public API and verified the relevance ordering and per-result scores.
The SDK and CLI also default to relevance starting with skillnet-ai 0.1.4. Please upgrade with:
pip install --upgrade skillnet-ai
hi do you have any other questions?