Skip to content

Commit 8caca9f

Browse files
committed
Fix: convert nano to ms and add searchAfter param
1 parent d3a1c8d commit 8caca9f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/quickwit/data_query.go

+7
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,13 @@ func processLogsQuery(q *Query, b *es.SearchRequestBuilder, from, to int64, defa
340340
b.Size(stringToIntWithDefaultValue(metric.Settings.Get("limit").MustString(), defaultSize))
341341
// TODO when hightlight is supported in quickwit
342342
// b.AddHighlight()
343+
344+
// This is currently used only for log context query to get
345+
// log lines before and after the selected log line
346+
searchAfter := metric.Settings.Get("searchAfter").MustArray()
347+
for _, value := range searchAfter {
348+
b.AddSearchAfter(value)
349+
}
343350
}
344351

345352
func processDocumentQuery(q *Query, b *es.SearchRequestBuilder, from, to int64, defaultTimeField string) {

src/datasource.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ export class QuickwitDataSource
436436

437437
private makeLogContextDataRequest = (row: LogRowModel, options?: LogRowContextOptions) => {
438438
const direction = options?.direction || LogRowContextQueryDirection.Backward;
439+
const searchAfterNs = row.dataFrame.fields.find((f) => f.name === 'sort')?.values.get(row.rowIndex) ?? [row.timeEpochNs]
440+
const searchAfterMs = [Math.round(searchAfterNs[0]/1000000)]
439441

440442
const logQuery: Logs = {
441443
type: 'logs',
@@ -445,7 +447,7 @@ export class QuickwitDataSource
445447
// Sorting of results in the context query
446448
sortDirection: direction === LogRowContextQueryDirection.Backward ? 'desc' : 'asc',
447449
// Used to get the next log lines before/after the current log line using sort field of selected log line
448-
searchAfter: row.dataFrame.fields.find((f) => f.name === 'sort')?.values.get(row.rowIndex) ?? [row.timeEpochMs],
450+
searchAfter: searchAfterMs,
449451
},
450452
};
451453

0 commit comments

Comments
 (0)