Information for programmers

Use with dtSearch Engine or dtSearch Web

See the dtSearch Engine Programmers Manual for additional details and sample code.

Single Language operation

If your application needs only to use stemming rules for a single language, simple take a copy of the desired stemming rule file from the ...\LEP500\Language\Stemming folder, rename it STEMMING.DAT and distribute copies of the file with your application.

Multiple Language operation

If you wish to make your application offer the end-user the ability to select which language stemming file to use. You should take copies of the stemming rule files that you need from the ...\LEP500\Language\Stemming folder and distribute them in the same folder, either the folder containing the dtSearch Text Retrieval Engine DLL (dten600.dll) or preferably in a sub-folder named Language.

Changing the stemming rules dynamically

If you need to have your users change the stemming rules dynamically when searching, note the following:

dtSearch Web

dtSearch Web loads the stemming rules once when it is initialised and then keeps those rules based on the stemming.dat file in the dtSearch Web folder (i.e. /scripts/dtSearch). Because Microsoft's IIS caches applications, dtSearch Web hardly ever re-initialises without a reboot, therefore changing the stemming rules does not have any effect.

Stemming rules can be changed dynamically as below, we recommend that you keep all stemming files in a language sub-folder beneath your application folder e.g. ...\Language\Stemming\st_language.dat"

dtSearch Web ASP interface

Dim opts

Set opts = theEngine.NewOptions

opts.StemmingRulesFile = "c:\Program Files\dtSearch Developer\Language\Stemming\st_language.dat"

opts.NoiseWordFile ="c:\Program Files\dtSearch Developer\Language\Stop\language.dat"

opts.Save

dtSearch Engine ASP .NET

Public TheEngine As dtengine.Server

TheEngine = New dtengine.Server()

Dim opt As New dtengine.Options()

opt = CType(TheEngine.NewOptions, dtengine.IOptions)

opt.StemmingRulesFile = "c:\Program Files\dtSearch Developer\Language\stemming\st_language.dat"

opt.NoiseWordFile ="c:\Program Files\dtSearch Developer\Language\Stop\language.dat"

opt.Save() ' Save new options

VB .NET

Dim opt as new dtSearch.Engine.Options

opt.StemmingRulesFile = "c:\Program Files\dtSearch Developer\Language\stemming\st_language.dat"

opt.NoiseWordFile ="c:\Program Files\dtSearch Developer\Language\Stop\language.dat"

opt.Save() ' Save new options



Java

com.dtsearch.engine.Options opt = new Options();

opt.setStemmingRulesFile("/folder/Language/stemming/st_language.dat");

opt.setNoiseWordFile("/folder/Language/Stop/language.data");

opt.save(); 

The Java example will be the same for Windows, Linux, and Android, but "/folder" should be replaced by the application folder.



dtSearch Engine (COM (VB))

' Create an Options object. It will be created with the existing options set up.

Dim opts as Object

Set opts = TheEngine.NewOptions()

' Modify options as needed. Options not changed will retain their original settings

opts.StemmingRulesFile = "c:\Program Files\dtSearch Developer\Language\stemming\st_language.dat"

opts.NoiseWordFile ="c:\Program Files\dtSearch Developer\Language\Stop\language.dat"

opts.Save() ' Save new options