What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
The PR fulfills these requirements:
Description:
This PR fixes issue #7467 where the AI query system was unable to find content in blog posts when using the -t blog filter.
Problem:
The npm run ai:query -- -q "term" -t blog command was failing to return results even when the search term existed in blog files. This was breaking the AI knowledge base's ability to access blog content, undermining the framework's "Anti-Hallucination Policy".
Root Cause:
- Blog content is stored in the knowledge base as
type: 'guide' with isBlog: true
- The query filter was incorrectly looking for
type: 'blog' (which doesn't exist)
- This mismatch caused zero results for all blog queries
Solution:
Updated the filtering logic in buildScripts/ai/queryKnowledgeBase.mjs to correctly handle blog queries:
// Before (broken)
whereClause = {type: type};
// After (fixed)
if (type === 'blog') {
whereClause = {
type: 'guide',
isBlog: 'true' // ChromaDB stores metadata as strings
};
} else {
whereClause = {type: type};
}
</div>
</div>
</div>
<div id="timeline-7472-1" class="neo-timeline-item comment" data-record-id="timeline-7472-1">
<div id="timeline-7472-1-target" class="neo-timeline-avatar">
<img src="https://github.com/tobiu.png?size=40" alt="tobiu" loading="lazy">
</div>
<div class="neo-timeline-content">
<div class="neo-timeline-header">
<a class="neo-timeline-user" href="https://github.com/tobiu" target="_blank">tobiu</a>
<span class="neo-timeline-date">commented on Oct 13, 2025, 10:39 AM</span>
</div>
<div class="neo-timeline-body">
<p>Thank you for correctly identifying the problem! More details from Gemini:</p>
<blockquote>
<p> ✦ Hi @harikrishna-au, thank you for your contribution and for fixing this bug!</p>
<p> Your analysis was spot-on. You correctly identified that the query was failing because it was looking for <code>type: 'blog'</code> while the data was stored as <code>{type: 'guide', isBlog: 'true'}</code>.</p>
<p> We are approving and merging this PR because it provides an effective and immediate fix to the problem.</p>
<p> From an architectural standpoint, this solution is a <strong>workaround</strong>. The change in <code>queryKnowledgeBase.mjs</code> patches the
issue on the "reading" side, but the root cause is on the "writing" side in <code>createKnowledgeBase.mjs</code>. The
long-term, more robust solution is to fix the data at its source by assigning <code>type: 'blog'</code> during the initial
indexing.</p>
<p> We will handle this refactoring in a follow-up task. Your work was crucial in highlighting this discrepancy and
getting the feature working again.</p>
<p> Great job, and we hope to see more contributions from you in the future.</p>
</blockquote>
<hr>
</div>
</div>
</div>
<div id="timeline-7472-2" class="neo-timeline-item comment" data-record-id="timeline-7472-2">
<div id="timeline-7472-2-target" class="neo-timeline-avatar">
<img src="https://github.com/tobiu.png?size=40" alt="tobiu" loading="lazy">
</div>
<div class="neo-timeline-content">
<div class="neo-timeline-header">
<a class="neo-timeline-user" href="https://github.com/tobiu" target="_blank">tobiu</a>
<span class="neo-timeline-date">commented on Oct 14, 2025, 12:50 PM</span>
</div>
<div class="neo-timeline-body">
<p>Test comment from the MCP server.</p>
<hr>
</div>
</div>
</div></div>
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
The PR fulfills these requirements:
devbranch, not themainbranchfix #xxx[,#xxx], where "xxx" is the issue number)Description:
This PR fixes issue #7467 where the AI query system was unable to find content in blog posts when using the
-t blogfilter.Problem: The
npm run ai:query -- -q "term" -t blogcommand was failing to return results even when the search term existed in blog files. This was breaking the AI knowledge base's ability to access blog content, undermining the framework's "Anti-Hallucination Policy".Root Cause:
type: 'guide'withisBlog: truetype: 'blog'(which doesn't exist)Solution: Updated the filtering logic in
buildScripts/ai/queryKnowledgeBase.mjsto correctly handle blog queries: