knowledge-base: retract an accepted record or its clauses on the operator's Approve

The operator prefers removing a wrong decision to stacking a correcting
record on it, and withdraw took only reserved or proposed records. retract
asks the operator through the router like a record that needs the operator,
and changes nothing until the Approve; a retracted record or clause no longer
holds in ask, holds, get, links and progress, history keeps every version, and
the whole-set rules still read a retracted record's links so a retraction alone
raises no finding. withdraw with retraction true takes a waiting one back.
This commit is contained in:
2026-10-31 10:07:58 +01:00
parent a68b39f7b5
commit f19e3ccffd
17 changed files with 856 additions and 51 deletions
@@ -473,10 +473,10 @@ func (s *PgStore) Search(ctx context.Context, question string, limit int) ([]Hit
select kind, number, clause, rank from (
select c.kind, c.number, c.n as clause, ts_rank_cd(c.search, q.q) as rank
from clause c join record r on r.kind = c.kind and r.number = c.number, q
where c.search @@ q.q and r.status not in ('reserved', 'withdrawn')
where c.search @@ q.q and r.status not in ('reserved', 'withdrawn', 'retracted') and c.status <> 'retracted'
union all
select r.kind, r.number, 0, ts_rank_cd(r.search, q.q)
from record r, q where r.search @@ q.q and r.status not in ('reserved', 'withdrawn')
from record r, q where r.search @@ q.q and r.status not in ('reserved', 'withdrawn', 'retracted')
) hits order by rank desc, number desc, clause limit $2`, strings.Join(words, " "), limit)
if err != nil {
return nil, err