refactor: remove SearXNG references and rename binary to kafka
- Rename cmd/searxng-go to cmd/kafka - Remove all SearXNG references from source comments while keeping "SearXNG-compatible API" in user-facing docs - Update binary paths in README, CLAUDE.md, and Dockerfile - Update log message to "kafka starting" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4482cb4dde
commit
fcd9be16df
18 changed files with 47 additions and 48 deletions
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/metamorphosis-dev/kafka/internal/contracts"
|
||||
)
|
||||
|
||||
// BraveEngine implements the SearXNG `braveapi` engine (Brave Web Search API).
|
||||
// BraveEngine implements the `braveapi` engine (Brave Web Search API).
|
||||
//
|
||||
// Config / gating:
|
||||
// - BRAVE_API_KEY: required to call Brave
|
||||
|
|
@ -35,8 +35,8 @@ func (e *BraveEngine) Search(ctx context.Context, req contracts.SearchRequest) (
|
|||
return contracts.SearchResponse{}, errors.New("brave engine not initialized")
|
||||
}
|
||||
|
||||
// Gate / config checks should not be treated as fatal errors; SearXNG
|
||||
// treats misconfigured engines as unresponsive.
|
||||
// Gate / config checks should not be treated as fatal errors; the reference
|
||||
// implementation treats misconfigured engines as unresponsive.
|
||||
if strings.TrimSpace(e.apiKey) == "" {
|
||||
return contracts.SearchResponse{
|
||||
Query: req.Query,
|
||||
|
|
@ -93,7 +93,7 @@ func (e *BraveEngine) Search(ctx context.Context, req contracts.SearchRequest) (
|
|||
}
|
||||
}
|
||||
|
||||
// SearXNG's python checks `if params["safesearch"]:` which treats any
|
||||
// The reference implementation checks `if params["safesearch"]:` which treats any
|
||||
// non-zero (moderate/strict) as strict.
|
||||
if req.Safesearch > 0 {
|
||||
args.Set("safesearch", "strict")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/metamorphosis-dev/kafka/internal/contracts"
|
||||
)
|
||||
|
||||
// Engine is a Go-native implementation of a SearXNG engine.
|
||||
// Engine is a Go-native implementation of a search engine.
|
||||
//
|
||||
// Implementations should return a SearchResponse containing only the results
|
||||
// for that engine subset; the caller will merge multiple engine responses.
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ func NewPlanner(portedEngines []string) *Planner {
|
|||
|
||||
// Plan returns:
|
||||
// - localEngines: engines that are configured as ported for this service
|
||||
// - upstreamEngines: engines that should be executed by upstream SearXNG
|
||||
// - upstreamEngines: engines that should be executed by the upstream instance
|
||||
// - requestedEngines: the (possibly inferred) requested engines list
|
||||
//
|
||||
// If the request provides an explicit `engines` parameter, we use it.
|
||||
|
|
@ -80,7 +80,7 @@ func (p *Planner) Plan(req contracts.SearchRequest) (localEngines, upstreamEngin
|
|||
|
||||
func inferFromCategories(categories []string) []string {
|
||||
// Minimal mapping for the initial porting subset.
|
||||
// This mirrors the idea of selecting from SearXNG categories without
|
||||
// This mirrors the idea of selecting from engine categories without
|
||||
// embedding the whole engine registry.
|
||||
set := map[string]bool{}
|
||||
for _, c := range categories {
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ import (
|
|||
"github.com/PuerkitoBio/goquery"
|
||||
)
|
||||
|
||||
// QwantEngine implements a SearXNG-like `qwant` (web) adapter using
|
||||
// QwantEngine implements a `qwant` (web) adapter using
|
||||
// Qwant v3 endpoint: https://api.qwant.com/v3/search/web.
|
||||
//
|
||||
// Qwant's API is not fully documented; this mirrors SearXNG's parsing logic
|
||||
// for the `web` category from `.agent/searxng/searx/engines/qwant.py`.
|
||||
// Qwant's API is not fully documented; this implements parsing logic
|
||||
// for the `web` category.
|
||||
type QwantEngine struct {
|
||||
client *http.Client
|
||||
category string // "web" (JSON API) or "web-lite" (HTML fallback)
|
||||
|
|
@ -37,7 +37,7 @@ func (e *QwantEngine) Search(ctx context.Context, req contracts.SearchRequest) (
|
|||
return contracts.SearchResponse{Query: req.Query}, nil
|
||||
}
|
||||
|
||||
// For API parity we use SearXNG web defaults: count=10, offset=(pageno-1)*count.
|
||||
// For API parity we use web defaults: count=10, offset=(pageno-1)*count.
|
||||
// The engine's config field exists so we can expand to news/images/videos later.
|
||||
count := e.resultsPerPage
|
||||
if count <= 0 {
|
||||
|
|
@ -262,7 +262,7 @@ func (e *QwantEngine) searchWebLite(ctx context.Context, req contracts.SearchReq
|
|||
return
|
||||
}
|
||||
|
||||
// In SearXNG: "./span[contains(@class, 'url partner')]"
|
||||
// Selector: "./span[contains(@class, 'url partner')]"
|
||||
urlText := strings.TrimSpace(item.Find("span.url.partner").First().Text())
|
||||
if urlText == "" {
|
||||
// fallback: any span with class containing both 'url' and 'partner'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue