SkillNet icon indicating copy to clipboard operation
SkillNet copied to clipboard

/v1/search: expose a relevance score; default order ranks by repo popularity

Open ether-btc opened this issue 1 month ago • 3 comments

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 either keyword or vector mode.
  • pdf form filling returned the same skill twice from the same repository, distinguished only by skill_dir (noted because repo_name alone 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

  1. Minimal (preferred): add a per-row relevance/similarity value to the response. Purely additive and backward-compatible; no default changes.
  2. Default to relevance for keyword mode, keeping stars as an explicit sort_by and as a min_stars filter. 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_dir and 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

  1. A keyword-mode row includes a per-row query-relevance value — or the docs state plainly that star-order is intended and recommend mode=vector for semantic ranking.
  2. 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/search on api-skillnet.openkg.cn, API 1.2.0, unauthenticated, no LLM key.
  • Read against zjunlp/SkillNet@c5271360115f0a1a4c4a6cae9dd639c7d278a00f; skillnet-ai 0.1.3.
  • All reproduction via curl / stdlib urllib; 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.

ether-btc avatar Oct 09 '26 16:10 ether-btc

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.

Icarus-Chen avatar Oct 10 '26 03:10 Icarus-Chen

Thanks for your patience. The BM25 keyword-search update is now live on the public API and both websites.

  • /v1/search keyword results now include relevance_score, based on skill names, descriptions, and tags.
  • Keyword search defaults to sort_by=relevance. Explicit stars/recent sorting and min_stars filtering remain available.
  • Scores reflect lexical relevance within a query. mode=vector remains 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

Icarus-Chen avatar Oct 13 '26 18:10 Icarus-Chen

hi do you have any other questions?

zxlzr avatar Oct 14 '26 02:10 zxlzr