text
stringlengths
0
234
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_5_NAME, -- index_id
Value => Object.Index);
Object.Clear_Modified (3);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
Function Definition: procedure Indexer is
Function Body: Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Indexer");
Factory : ADO.Sessions.Factory.Session_Factory;
Count : constant Natural := Ada.Command_Line.Argument_Count;
begin
ADO.SQLite.Initialize;
Factory.Create ("sqlite:///search.db?synchronous=OFF&encoding='UTF-8'");
if Count < 1 then
Ada.Text_IO.Put_Line ("Usage: indexer file...");
return;
end if;
declare
DB : ADO.Sessions.Master_Session := Factory.Get_Master_Session;
Indexer : Search.Indexers.Databases.Indexer_Type;
Analyzer : Search.Analyzers.French.Analyzer_Type;
Tokenizer : Search.Tokenizers.Tokenizer_Type;
begin
Indexer.Initialize (DB, ADO.NO_IDENTIFIER);
for I in 1 .. Count loop
declare
Path : constant String := Ada.Command_Line.Argument (I);
Doc : Search.Documents.Document_Type;
begin
Doc.Add_Field ("path", Path, Search.Fields.F_PATH);
Indexer.Add_Document (Doc, Analyzer, Tokenizer);
Function Definition: procedure Finder is
Function Body: Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Indexer");
Factory : ADO.Sessions.Factory.Session_Factory;
Count : constant Natural := Ada.Command_Line.Argument_Count;
begin
ADO.SQLite.Initialize;
Factory.Create ("sqlite:///search.db?synchronous=OFF&encoding='UTF-8'");
if Count < 1 then
Ada.Text_IO.Put_Line ("Usage: finder query...");
return;
end if;
declare
DB : ADO.Sessions.Master_Session := Factory.Get_Master_Session;
Indexer : Search.Indexers.Databases.Indexer_Type;
Analyzer : Search.Analyzers.French.Analyzer_Type;
Tokenizer : Search.Tokenizers.Tokenizer_Type;
begin
Indexer.Initialize (DB, ADO.NO_IDENTIFIER);
for I in 1 .. Count loop
declare
Query : constant String := Ada.Command_Line.Argument (I);
Result : Search.Results.Result_Vector;
begin
Indexer.Find (Query, Analyzer, Tokenizer, Result);
for Item of Result loop
declare
Doc : Search.Documents.Document_Type;
Field : Search.Fields.Field_Type;
begin
Indexer.Load (Doc, Item.Doc_Id);
Field := Doc.Get_Field ("path");
Ada.Text_IO.Put_Line (Search.Fields.Get_Value (Field));
Function Definition: procedure Remove_Node is new Ada.Unchecked_Deallocation (Node_Type, Node_Access_Type);
Function Body: procedure Remove_List is new Ada.Unchecked_Deallocation (List_Header_Type, List_Header_Access_Type);
---------------------------------------------------------------------
function Initialise return List_Header_Access_Type is
Temp_Entry: List_Header_Access_Type;
begin
--
-- allocate new memory for the header information
--
Temp_Entry := new List_Header_Type;
--
-- and set the fields up. These could be replaced by default values in the
-- record declaration.
--
Temp_Entry.First_Entry := null;
Temp_Entry.Count := 0;