This file is indexed.

/usr/share/doc/fp-units-misc/2.6.4/examples/fpindexer/TestSearch.pp is in fp-units-misc-2.6.4 2.6.4+dfsg-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
program TestSearch;

{ $define usefirebird}
{ $define usemem}
{$mode objfpc}{$H+}
{$IFDEF UNIX}
  {$linklib pthread}
{$ENDIF}

uses
  SysUtils,
  {$IFDEF UNIX} {$IFDEF UseCThreads}
    cthreads,
  {$ENDIF} {$ENDIF}
  {$ifdef usefirebird}
    SQLDBIndexDB, fbIndexdb,
  {$else}
    {$ifdef usemem}
      memindexdb,
    {$else}
      SQLIteIndexDB,
    {$endif}
  {$endif}
  fpIndexer;

procedure usage;

begin
  Writeln('Usage : ',ExtractFileName(ParamStr(0)),' [-e] databasename word');
  Writeln(' -e  : Exact match only');
  halt(1);
end;

var
  Search: TFPSearch;   //searches phrases
  start: TDateTime;
  endtime: TDateTime;
  i: integer;
  n: int64;

{$ifdef usefirebird}
  Function CreateDB(const dbName : String) : TCustomIndexDB;
  Var
    IB: TFBIndexDB;
  begin
    IB := TFBIndexDB.Create(nil);
    IB.DatabasePath := dbname;
    IB.UserName := 'WISASOFT';
    IB.Password := 'SysteemD';
    if not FileExists(IB.DatabasePath) then
    begin
      writeln('error: could not find index database');
      halt;
    end
    else
      IB.Connect;
    Result:=IB;
  end;
{$else}
  {$ifdef usemem}
    Function CreateDB (const dbName : String) : TCustomIndexDB;
    Var
      FB: TFileIndexDB;
    begin
      FB:=TFileIndexDB.Create(Nil);
      FB.FileName:=dbName;
      FB.Connect;
      Result:=FB;
    end;
  {$else}
    Function CreateDB  (const dbName : String) : TCustomIndexDB;
    Var
      SB: TSQLIteIndexDB;
    begin
      SB := TSQLIteIndexDB.Create(nil);
      SB.FileName := dbname;
      if not FileExists(SB.FileName) then
      begin
        writeln('error: could not find index database');
        halt;
      end
      else
        SB.Connect;
      Result:=SB;
    end;
  {$endif}
{$endif}

Var
  DB : String;

{$R *.res}

begin
  start := Now;
  Search := TFPSearch.Create(nil);
  //setup parameters for indexing
  if (ParamCount<2) or (ParamCount>3) then
    Usage;
  if (ParamCount=2)  then
    begin
    DB:=ParamStr(1);
    Search.SetSearchWord(ParamStr(2));
    Search.Options := [soContains]; //allowed to search with wildcards
    end
  else
    begin
    if (ParamStr(1)<>'-e') then
      Usage;
    DB:=ParamStr(2);
    Search.SetSearchWord(ParamStr(3));
    end;
  Search.Database := CreateDB(DB);
  //execute the search
  N := Search.Execute;
  endtime := Now;
  if N <> 0 then
  begin
    writeln('Searching for word: ', ParamStr(1));
    writeln;

    for i := 0 to Search.RankedCount - 1 do
      with Search.RankedResults[i] do
        writeln(Format('rank:%d word:%s pos:%d lang:%s %s filedate:%s context:%s', [Rank, SearchWord, Position, Language, URL, DateTimeToStr(FileDate), Context]));
  end;

  writeln;
  writeln(Format('done in %.3f sec.', [(endtime - start) * 24 * 3600]));
end.