diff --git a/backend/src/knowledge/adapters/semantic-projection.adapter.ts b/backend/src/knowledge/adapters/semantic-projection.adapter.ts index e74ae52..3c6b90d 100644 --- a/backend/src/knowledge/adapters/semantic-projection.adapter.ts +++ b/backend/src/knowledge/adapters/semantic-projection.adapter.ts @@ -53,14 +53,10 @@ export class DefaultSemanticProjectionAdapter implements SemanticProjectionAdapt input.record?.subject || `${input.objectApiName} ${input.record?.id || ''}`.trim(); - /* + const fieldNarrative = fieldEntries .map(([key, value]) => `${key}: ${String(value)}`) .join('\n'); - */ - const fieldNarrative = fieldEntries - .map(([key, value]) => `${String(value)}`) - .join('\n'); const commentNarrative = (input.comments || []) .map((comment, index) => `Comment ${index + 1}: ${comment.content}`) @@ -68,9 +64,10 @@ export class DefaultSemanticProjectionAdapter implements SemanticProjectionAdapt const narrative = [fieldNarrative, commentNarrative].filter(Boolean).join('\n\n'); - // Temporary: use only the name field for embedding to test pure semantic matching. - // Widen this back to all field values once semantic results are validated. - const embeddingNarrative = String(input.record?.name || title); + // Plain values only — no 'key:' prefixes. Comments are handled separately by the chunker. + const embeddingNarrative = fieldEntries + .map(([, value]) => String(value)) + .join('\n'); return { entityType: input.objectApiName, diff --git a/backend/src/knowledge/services/semantic-orchestrator.service.ts b/backend/src/knowledge/services/semantic-orchestrator.service.ts index 7f93d23..c0d5d3e 100644 --- a/backend/src/knowledge/services/semantic-orchestrator.service.ts +++ b/backend/src/knowledge/services/semantic-orchestrator.service.ts @@ -72,9 +72,7 @@ export class SemanticOrchestratorService { }); const documentId = await this.upsertSemanticDocument(knex, projection); - // Temporary: pass empty comments so only embeddingNarrative (name field) is indexed. - // Re-enable by replacing [] with `comments` once semantic matching is validated. - const chunks = this.chunkerService.chunkText(projection.embeddingNarrative, []); + const chunks = this.chunkerService.chunkText(projection.embeddingNarrative, comments); this.logger.log( `Semantic refresh chunking: ${objectApiName}:${recordId} chunks=${chunks.length}`, );