@@ -83,8 +83,8 @@ func performIncrementalIndexing() {
8383// needsIncrementalIndexing checks if a log file needs incremental indexing
8484func needsIncrementalIndexing (log * nginx_log.NginxLogWithIndex ) bool {
8585 // Skip if already indexing or queued
86- if log .IndexStatus == string (indexer .IndexStatusIndexing ) ||
87- log .IndexStatus == string (indexer .IndexStatusQueued ) {
86+ if log .IndexStatus == string (indexer .IndexStatusIndexing ) ||
87+ log .IndexStatus == string (indexer .IndexStatusQueued ) {
8888 return false
8989 }
9090
@@ -106,14 +106,14 @@ func needsIncrementalIndexing(log *nginx_log.NginxLogWithIndex) bool {
106106
107107 // File was modified after last index and size increased
108108 if fileModTime .After (lastModified ) && fileSize > log .LastSize {
109- logger .Debugf ("File %s needs incremental indexing: mod_time=%s, size=%d" ,
109+ logger .Debugf ("File %s needs incremental indexing: mod_time=%s, size=%d" ,
110110 log .Path , fileModTime .Format ("2006-01-02 15:04:05" ), fileSize )
111111 return true
112112 }
113113
114114 // File size decreased - might be file rotation
115115 if fileSize < log .LastSize {
116- logger .Debugf ("File %s needs full re-indexing due to size decrease: old_size=%d, new_size=%d" ,
116+ logger .Debugf ("File %s needs full re-indexing due to size decrease: old_size=%d, new_size=%d" ,
117117 log .Path , log .LastSize , fileSize )
118118 return true
119119 }
@@ -131,7 +131,7 @@ func queueIncrementalIndexing(logPath string, modernIndexer interface{}, logFile
131131 // Queue the indexing job asynchronously
132132 go func () {
133133 logger .Infof ("Starting incremental indexing for file: %s" , logPath )
134-
134+
135135 // Set status to indexing
136136 if err := setFileIndexStatus (logPath , string (indexer .IndexStatusIndexing ), logFileManager ); err != nil {
137137 logger .Errorf ("Failed to set indexing status for %s: %v" , logPath , err )
@@ -140,8 +140,8 @@ func queueIncrementalIndexing(logPath string, modernIndexer interface{}, logFile
140140
141141 // Perform incremental indexing
142142 startTime := time .Now ()
143- docsCountMap , minTime , maxTime , err := modernIndexer .(* indexer.ParallelIndexer ).IndexLogGroupWithProgress (logPath , nil )
144-
143+ docsCountMap , minTime , maxTime , err := modernIndexer .(* indexer.ParallelIndexer ).IndexSingleFileIncrementally (logPath , nil )
144+
145145 if err != nil {
146146 logger .Errorf ("Failed incremental indexing for %s: %v" , logPath , err )
147147 // Set error status
@@ -184,25 +184,25 @@ func setFileIndexStatus(logPath, status string, logFileManager interface{}) erro
184184 if logFileManager == nil {
185185 return fmt .Errorf ("log file manager not available" )
186186 }
187-
187+
188188 // Get persistence manager
189189 lfm , ok := logFileManager .(* indexer.LogFileManager )
190190 if ! ok {
191191 return fmt .Errorf ("invalid log file manager type" )
192192 }
193-
193+
194194 persistence := lfm .GetPersistence ()
195195 if persistence == nil {
196196 return fmt .Errorf ("persistence manager not available" )
197197 }
198-
198+
199199 // Use enhanced SetIndexStatus method with queue position for queued status
200200 queuePosition := 0
201201 if status == string (indexer .IndexStatusQueued ) {
202202 // For incremental indexing, we don't need specific queue positions
203203 // They will be processed as they come
204204 queuePosition = int (time .Now ().Unix () % 1000 ) // Simple ordering by time
205205 }
206-
206+
207207 return persistence .SetIndexStatus (logPath , status , queuePosition , "" )
208- }
208+ }
0 commit comments