Skip to content

Commit ef84ab9

Browse files
committed
fix(docql): require query parameter in DocQLSearchStats #453
Remove default value for query and ensure it is explicitly set when creating DocQLSearchStats instances.
1 parent 20a84f9 commit ef84ab9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl/docql/DocQLDirectQueryExecutor.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class DocQLDirectQueryExecutor(private val maxResults: Int) {
2828
val detailedResults = DocQLResultFormatter.formatDocQLResult(result, maxResults)
2929
val stats = DocQLSearchStats(
3030
searchType = DocQLSearchStats.SearchType.DIRECT_QUERY,
31+
query = query,
3132
channels = listOf(extractQueryType(query)),
3233
documentsSearched = 1,
3334
totalRawResults = result.getResultCount(),
@@ -60,6 +61,7 @@ class DocQLDirectQueryExecutor(private val maxResults: Int) {
6061
val fullResults = result.toString()
6162
val detailedResults = DocQLResultFormatter.formatDocQLResult(result, maxResults)
6263
val stats = DocQLSearchStats(
64+
query = query,
6365
searchType = DocQLSearchStats.SearchType.DIRECT_QUERY,
6466
channels = listOf(extractQueryType(query)),
6567
documentsSearched = docsSearched,
@@ -85,6 +87,7 @@ class DocQLDirectQueryExecutor(private val maxResults: Int) {
8587
val suggestion = DocQLResultFormatter.buildQuerySuggestion(query)
8688

8789
val emptyStats = DocQLSearchStats(
90+
query = query,
8891
searchType = DocQLSearchStats.SearchType.DIRECT_QUERY,
8992
channels = listOf(extractQueryType(query)),
9093
documentsSearched = 0,

mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl/docql/DocQLSearchStats.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data class DocQLSearchStats(
1212
/** Type of search performed */
1313
val searchType: SearchType,
1414
/** The original query string */
15-
val query: String = "",
15+
val query: String,
1616
/** The document path if specified */
1717
val documentPath: String? = null,
1818
/** Query channels used (for smart search) */

0 commit comments

Comments
 (0)