Merge pull request 'fix(sessions): use entities query for list (hybridSearch requires project)' (#59) from fix/sessions-list-entities-query into main
CI / CI (push) Successful in 3m18s
CI / CI (push) Successful in 3m18s
This commit was merged in pull request #59.
This commit is contained in:
@@ -180,9 +180,12 @@ func (h *Handler) handleList(w http.ResponseWriter, r *http.Request) {
|
|||||||
searchQuery = fmt.Sprintf("%s cwd:%s", searchQuery, cwd)
|
searchQuery = fmt.Sprintf("%s cwd:%s", searchQuery, cwd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// entities query (not hybridSearch) — project arg is optional, so it queries
|
||||||
|
// across ALL projects. Required because each session lives in its own
|
||||||
|
// session-<uuid> project; there is no single project to hybridSearch against.
|
||||||
gqlQuery := `query($q:String!,$limit:Int!){
|
gqlQuery := `query($q:String!,$limit:Int!){
|
||||||
hybridSearch(query:$q,limit:$limit,entityType:SESSION){
|
entities(query:$q,limit:$limit,entityType:SESSION){
|
||||||
entities{id name summary tCreated}
|
entities{id name summary projectId tCreated}
|
||||||
searchMode
|
searchMode
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ import (
|
|||||||
// "query" field and records captured request bodies.
|
// "query" field and records captured request bodies.
|
||||||
//
|
//
|
||||||
// - "upsertEntity" → mutation response
|
// - "upsertEntity" → mutation response
|
||||||
// - "hybridSearch" → search response
|
// - "hybridSearch" → search response (get, patch, episodes handlers)
|
||||||
|
// - "entities" → list response (sessions list handler)
|
||||||
// - "entity" → single entity response
|
// - "entity" → single entity response
|
||||||
func newGQLServer(t *testing.T, captured *[]byte) *httptest.Server {
|
func newGQLServer(t *testing.T, captured *[]byte) *httptest.Server {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
@@ -33,7 +34,11 @@ func newGQLServer(t *testing.T, captured *[]byte) *httptest.Server {
|
|||||||
case strings.Contains(bs, "upsertEntity"):
|
case strings.Contains(bs, "upsertEntity"):
|
||||||
fmt.Fprint(w, `{"data":{"upsertEntity":{"id":"test-entity-id","created":true}}}`)
|
fmt.Fprint(w, `{"data":{"upsertEntity":{"id":"test-entity-id","created":true}}}`)
|
||||||
case strings.Contains(bs, "hybridSearch"):
|
case strings.Contains(bs, "hybridSearch"):
|
||||||
|
// get, patch, episodes handlers still use hybridSearch
|
||||||
fmt.Fprint(w, `{"data":{"hybridSearch":{"entities":[]}}}`)
|
fmt.Fprint(w, `{"data":{"hybridSearch":{"entities":[]}}}`)
|
||||||
|
case strings.Contains(bs, "entities"):
|
||||||
|
// sessions list handler uses entities query
|
||||||
|
fmt.Fprint(w, `{"data":{"entities":{"entities":[]}}}`)
|
||||||
case strings.Contains(bs, "entity"):
|
case strings.Contains(bs, "entity"):
|
||||||
fmt.Fprint(w, `{"data":{"entity":null}}`)
|
fmt.Fprint(w, `{"data":{"entity":null}}`)
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user