Skip to content

Commit

Permalink
Don't store the pois of OTP modules in ets at startup
Browse files Browse the repository at this point in the history
They take up a lot of memory, duplicated for each project, and most of then not
used. They will be reloaded and inserted when needed by calling
`els_utils:lookup_document/1` so there is no information loss.
  • Loading branch information
gomoripeti committed Jan 31, 2021
1 parent edef440 commit 0c60d94
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/els_indexing.erl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ index(Uri, Text, Mode) ->

-spec do_index(els_dt_document:item(), mode()) -> ok.
do_index(#{uri := Uri, id := Id, kind := Kind} = Document, Mode) ->
ok = els_dt_document:insert(Document),
case Mode of
'deep' ->
ok = els_dt_document:insert(Document);
'shallow' ->
%% Don't store detailed POIs when "shallow" indexing.
%% They will be reloaded and inserted when needed
%% by calling els_utils:lookup_document/1
ok
end,
%% Mapping from document id to uri
ModuleItem = els_dt_document_index:new(Id, Uri, Kind),
ok = els_dt_document_index:insert(ModuleItem),
Expand Down

0 comments on commit 0c60d94

Please sign in to comment.