Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Binary data in Memo field
Thu, Jun 1 2006 9:44 AMPermanent Link

Mike Mayer
Hello,

I have one table with two field Data(Blob) and Extension(String),
in Data field I store filenames and in Extension - file name extension like
doc, txt, rtf or exe.

I want to perform full text search inside Data field for files which can be searchable
for example txt, rtf and etc. It will not be hard to exclude not searchable data using Extension field.

The problem is that Binary field can't be indexed, so I need change it to Memo field but
I am afraid that here can be a problem with Binary data inside memo field although they will not be searchable.

Maybe anyone could propose the suggestion to my dilemma?

Regards,
Mike
Thu, Jun 1 2006 10:58 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Mike


There's no problem with storing binary data in a memo field. Essentially they are both the same anyway.

My apps store images, files, tables and multiple streams all in memo fields.

Roy Lambert
Thu, Jun 1 2006 3:17 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mike,

<< The problem is that Binary field can't be indexed, so I need change it to
Memo field but I am afraid that here can be a problem with Binary data
inside memo field although they will not be searchable. >>

You can do what you want, but save yourself some trouble and add a
TDBISAMEngine.OnTextIndexFilter event handler so that you can filter out
anything that contains characters that are less than Chr(32) and not tabs or
CRLFs:

procedure TMainForm.DBISAMEngineTextIndexFilter(Sender: TObject;
 const TableName, FieldName: String; var TextToIndex: String);
begin
   if (FieldName='MyBlobField') and ContainsBinaryChars(TextToIndex) then
     TextToIndex:='';
end;

function ContainsBinaryChars(const Text: String): Boolean;
begin
  Result:=False;
  for I:=1 to Length(Text) do
     begin
     if (Ord(Text[I]) < 32) and (not (Text[I] in [#9,#10,#13])) then
        begin
        Result:=True;
        Break;
        end;
     end;
end;

That will prevent DBISAM from indexing most, if not all, binary data, thus
saving quite a bit of time (even with the text index filtering in place).

--
Tim Young
Elevate Software
www.elevatesoft.com

Image