Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Creating a custom word generator
Tue, Jul 24 2012 1:25 PMPermanent Link

Rolf Frei

eicom GmbH

I'm trying to write my own wordgenerator but as a lack of good
documentation, I'm not sure where to do what I need. I want to have some
different IncludeChars and SpaceChars, but how and where can I set this? In
which function in the auto generated DLL sceleton must I do this? What
routine is called for the initialization? Is OpenEDBModule the right place
for changing the global IncludeChars and SpaceChars variables? Also the
Stoppwords must be read in from an customizable text file. Can this be done
here as well?

Regards
Rolf
Wed, Jul 25 2012 3:51 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Rolf


Have a look in the extensions ng. My code for a word generator & text filter are in there.

Roy Lambert [Team Elevate]
Wed, Jul 25 2012 7:10 AMPermanent Link

Rolf Frei

eicom GmbH

Roy

I have looked already there, but it seems that you used a normal word
generator modul, as I use a lightweight version, which seems to be right
different.  At the moment I do the initalization things, like creating an
internal TStringlist, changing the global SpaceChars and InlcudeChars, in
the OpenEDBModule function and cleaning it up is done in CloseEDBModule. It
looks as this at the moment:


function OpenEDBModule(var ModuleHandle: TEDBIntPtr): Boolean; stdcall;
var
 i: Integer;
begin
  try
     ModuleHandle:=TEDBIntPtr(TEDBWordGeneratorModule.Create);

     { Creating/Changing my own Stuff }
     StoppWords := TStringList.Create;
     for i := 0 to High(STOP_WORDS) do
       StoppWords.Add(STOP_WORDS[i]);
     StoppWords.Sort;

     IncludeChars.AddCharRange('0','9');
     SpaceChars.RemoveChar('.'); //decimal
     SpaceChars.RemoveChar('/'); //slash
     SpaceChars.RemoveChar('-'); //dash

     Result:=True;
  except
     Result:=False;
  end;
end;

function CloseEDBModule(ModuleHandle: TEDBIntPtr): Boolean; stdcall;
var
  TempWordGeneratorModule: TEDBWordGeneratorModule;
begin
  try
     TempWordGeneratorModule:=TEDBWordGeneratorModule(ModuleHandle);
     FreeAndNil(TempWordGeneratorModule);

     { Cleanup allocated Objects }
     FreeAndNil(StoppWords);

     Result:=True;
  except
     Result:=False;
  end;
end;


Is it correct this way? Is it correct to use the gloabal IncludeChars and
SpaceChars here? It seems to work, but I'm unsure if there may be side
effects.

Regards
Rolf


"Roy Lambert"  schrieb im Newsbeitrag
news:E6C44663-B267-4124-A7CF-40CFCEB06CF0@news.elevatesoft.com...

Rolf


Have a look in the extensions ng. My code for a word generator & text filter
are in there.

Roy Lambert [Team Elevate]
Wed, Jul 25 2012 9:34 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Rolf

>I have looked already there, but it seems that you used a normal word
>generator modul, as I use a lightweight version, which seems to be right
>different.

My initial one was based on the "heavyweight" code supplied by Tim but I moaned a lot about all the baggage it carried and the new "lightweight" version was created. I've posted my current versions into the extensions ng.

I use the modules initialization / finalization sections to set things up / free things

Roy Lambert [Team Elevate]
Wed, Jul 25 2012 1:46 PMPermanent Link

Rolf Frei

eicom GmbH

Roy

Thanks. It is still not clear what is with the global variables IncludeChars
and SpaceChars. Can I change this variables for my need without to change
the default wordgenerator too. Does a change in this variables affect the
dfeault wordgenerator or are they only visible in my DLL? I didn't use any
DLL's yet and as such I'm not sure how such stuff is visible to the main
executable/ edb engine. Is it better to create my own instances of this
classes? Tim?

Regards
Rolf

"Roy Lambert"  schrieb im Newsbeitrag
news:B9CD859C-BBFF-495E-95AB-91CC7F593ADE@news.elevatesoft.com...

Rolf

>I have looked already there, but it seems that you used a normal word
>generator modul, as I use a lightweight version, which seems to be right
>different.

My initial one was based on the "heavyweight" code supplied by Tim but I
moaned a lot about all the baggage it carried and the new "lightweight"
version was created. I've posted my current versions into the extensions ng.

I use the modules initialization / finalization sections to set things up /
free things

Roy Lambert [Team Elevate]
Thu, Jul 26 2012 3:28 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Rolf

>Thanks. It is still not clear what is with the global variables IncludeChars
>and SpaceChars. Can I change this variables for my need without to change
>the default wordgenerator too. Does a change in this variables affect the
>dfeault wordgenerator or are they only visible in my DLL? I didn't use any
>DLL's yet and as such I'm not sure how such stuff is visible to the main
>executable/ edb engine. Is it better to create my own instances of this
>classes? Tim?

Whilst I'm not Tim I would say that altering the global variables will impact on the default wordgenerator/textfilter and personally I wouldn't touch them. I've taken the approach that as with threads isolation is the best option.

Tim has built in an architecture to allow the dlls to be loaded and used in multiple apps including EDBManager. If you don't follow that route then you're essentially back to the same situation that we had with DBISAM.

Roy Lambert [Team Elevate]
Thu, Aug 2 2012 4:59 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Rolf,

Answered via email:

<< 1. I must write my own word generator (lightweight) and textfilter. Is it
save to use/change the global variables IncludeChars and SpaceChars in the
DLL or does this also change the default wordgenerator? Are this variables
somehow shared with the engine itself? Must I create my own instances of
this variables to not interfere with the engine itself. >>

The DLL uses a completely-separate global variable space, so yes, you can
use any global variables that you like.

<< 2. Where is the best place to initialize my own objects like a
TStringList and where to destroy them. At the moment I create them in
OpenEDBModule and free it in CloseEDBModule. Is this correct this way? It
seems to work, but I'm not sure if all is correct that way. >>

While you can use those, I wouldn't do so.  It's much better to use the
Create/Destroy methods of the TEDBWordGeneratorModule object.

<< 3. Is there some way to get the values from more than one field into one
single Textindex like in DBISAM? >>

No.  In fact, it's much better not to do so because doing so causes the one
text index to balloon in size, making searches slower than necessary.

<< 4. How is the Text Index Word Length option related to the Word Generator
MAX_WORD_SIZE constant? Must they be identical? >>

No, the MAX_WORD_SIZE is simply the value used by EDB as the default maximum
word size.

Tim Young
Elevate Software
www.elevatesoft.com
Image