Now we have a good sense of just how slow it is. But it may be ok if we can specify the date to start searching from.
WRW43ITLCVJQ37KYCE4YKIW5XGRD2Q6XVLCPSH6M2YBRKSQVQ5CQC
--? print('searching '..current_filename..' for '..Display_settings.search_all_term)
local contents = love.filesystem.read(Directory..current_filename)
local index = contents:find(Display_settings.search_all_term)
if index then
local id = id_for_search_all_pane(Display_settings.search_all_term)
local snippet = contents:sub(math.max(1, index-100), math.min(#contents, index+100))
local outfilename = Directory..id
local success, errmsg = love.filesystem.append(outfilename, '[['..current_filename..']]\t')
if not success then error(errmsg) end
local success, errmsg = love.filesystem.append(outfilename, '...'..snippet..'...\n\n')
if not success then error(errmsg) end
load_from_disk(Cache[id])
Display_settings.search_all_pane.lines = Cache[id].lines
Text.redraw_all(Display_settings.search_all_pane)
end
search_in_file(current_filename)
local files = love.filesystem.getDirectoryItems(date_dir)
for _,file in ipairs(files) do
print(date_dir..file)
local filenames = love.filesystem.getDirectoryItems(date_dir)
for _,filename in ipairs(filenames) do
--? print(date_dir..filename)
search_in_file(Display_settings.search_all_state.date..filename)
function search_in_file(filename)
--? print('searching '..filename..' for '..Display_settings.search_all_term)
local contents = love.filesystem.read(Directory..filename)
if contents == nil then
error('no contents in '..filename)
end
local index = contents:find(Display_settings.search_all_term)
if index then
local id = id_for_search_all_pane(Display_settings.search_all_term)
local snippet = contents:sub(math.max(1, index-100), math.min(#contents, index+100))
local outfilename = Directory..id
local success, errmsg = love.filesystem.append(outfilename, '[['..filename..']]\t')
if not success then error(errmsg) end
local success, errmsg = love.filesystem.append(outfilename, '...'..snippet..'...\n\n')
if not success then error(errmsg) end
load_from_disk(Cache[id])
Display_settings.search_all_pane.lines = Cache[id].lines
Text.redraw_all(Display_settings.search_all_pane)
refresh_pane_height(Display_settings.search_all_pane)
end
end