# ExHelp

HDescription:
Base class for many Rubicon components.

Do not create instances of TrbBase.  Properties and methods of TrbBase provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure AfterState(Engine : TrbEngine; AState : TEngineState);


HDeclaration:
procedure BeforeState(Engine : TrbEngine; AState : TEngineState);


HDeclaration:
function BooleanParam(const Param : String; Default : Boolean) : Boolean;


HDeclaration:
function IntegerParam(const Param : String; Default : Integer) : Integer;


HDescription:
This property may be used to store special processing instructions.  Instructions are stored in the list as values.  There is usually no need to use this property except in specialized circumstances.

To see how the property is used, search the source code for BooleanParam.  Here are some of the recognized instructions:

CreateDataSet: controls whether the DataSet is created
AddWordIndex: controls whether the Word index is added
AddWordIndexAtStart: add the Word index before words are added to the table
AddLikeIndex: controls whether the Like index is added

HExample:
with rbMakeWordsTableLink1.Params do
 begin
  Clear;
  Add('CreateDataSet=True');
  Add('AddWordIndex=T');
  Add('AddWordIndexAtStart=1');
  Add('AddLikeIndex=0)
 end;


HDeclaration:
procedure ReadStream(Engine : TrbEngine; Reader : TReader);


HDeclaration:
function StringParam(const Param,Default : String) : String;


HDeclaration:
procedure WriteStream(Engine : TrbEngine; Writer : TWriter);


HDescription:
This class defines the properties and methods of a TextLink.

Do not create instances of TrbTextLink.  Use TrbTextLink as a base class when declaring text link objects.  Properties and methods of TrbTextLink provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
This event is called after Rubicon component reads the text in the TextLink.

HExample:
procedure TForm1.rbTextTableLink1AfterProcess(Sender: TObject);
begin
 MessageBeep(0)
end;


HDeclaration:
procedure CheckLocation(ALocation : LongInt; Inserting : Boolean);


HDeclaration:
function GotoLocation(ALocation : LongInt) : Boolean;


HDeclaration:
function GotoNearestLocation(ALocation : LongInt) : Boolean;


HDescription:
Difference between the minimum index value and the maximum index value. 

Run-time and read only.

HExample:
if rbMake1.TextLink.IndexRange > 1000000 then
 MessageDlg('This may take a while',mtWarning,[mbOk],0);


HDescription:
The maximum value of index used in the text.

HExample:
with rbTextTableLink1 do
 begin
  MaxIndexLabel.Caption := IntToStr(MaxIndex);
  MinIndexLabel.Caption := IntToStr(MinIndex)
 end;


HDescription:
The minimum value of the index used in the text.

Most internal data structures do not store the absolute value of the texts location, but rather the offset relative to the MinIndex.  Thus, when working with the MatchBits methods FirstSet, NextSet, PrevSet, LastSet (and the equivalent XxxxClear routines), MinIndex should be added to the return value in order to identify the correct location in the text.

Run-time and read only.

HExample:
with rbSearch1, rbTextTableLink1 do
 begin
  ALocation := MatchBits.FirstSet;
  if (ALocation <> -1) and (IndexFieldName <> '') then
   Table.FindKey([ALocation + MinIndex])
 end;


HDescription:
This counter records the number of times Text has been read.

Run-time and read only.


HExample:
procedure TForm1.btnReset(Sender: TObject);
begin
 rbUpdate1.TextLink.ResetCounters
end;


HDescription:
This class defines the properties and methods of a WordsLink.

Do not create instances of TrbWordsLink.  Use TrbWordsLink as a base class when declaring search objects.  Properties and methods of TrbWordsLink provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
This notification event is called after a record is posted to the WordsLink.

HExample:
procedure TForm1.rbWordsTableLink1AfterPost(Sender: TObject);
begin
 MessageBeep(0)
end;


HDescription:
Returns the number of blob bytes read from the WordsLink.  Does not include any blob field related overhead (which varies by table type).  

Run-time and read only.

HSee_Also:
BlobBytesWritten, DeleteCounter, EditCounter, InsertCounter, ReadCounter, ResetStats


HDescription:
Returns the number of blob bytes written to the WordsLink.  Does not include any blob field related overhead (which varies by table type).  

Run-time and read only.


HDescription:
Number of deletes processed.

Run-time and read only.

HExample:
with rbWordsTableLink1 do
 if DeleteCounter + EditCounter + InsertCounter > 100 then
  begin
   MessageBeep(0);
   ResetCounters
  end;


HDescription:
Number of edits processed.

Run-time and read only.


HDeclaration:
function Eof : Boolean;
 function GotoWord(Word : String; Segment : Integer) : Boolean; virtual; abstract;.


HDeclaration:
function GotoWord(Word : String; Segment : Integer; ReadOnly : Boolean) : Boolean;


HDeclaration:
procedure HintList(S : String; NoLT, NoGE : Integer ;
                      List : TStrings); virtual; abstract;


HDescription:
Number of inserts processed.

Run-time and read only.


HDeclaration:
procedure PrepareScan(S : String; AnyChar,OneChar : Char);


HDescription:
Number of reads processed.

Run-time and read only.


HDeclaration:
procedure ReadData(var Data; Bytes : LongInt);


HDescription:
Indicates whether the Words are segmented or not.


HDeclaration:
function BitIsSet(N : LongInt) : Boolean;


HDeclaration:
function Compress(Source,Dest : Pointer) : LongInt;


HDeclaration:
procedure ControlBit(OldData,NewData : Pointer; N : LongInt; State : Boolean);


HDeclaration:
function CopyTo(Dest : Pointer) : LongInt;


HDeclaration:
procedure Decompress(Source : Pointer; Segment,SegmentSize : LongInt);


HDescription:
Root cache class.

Do not create instances of TrbBaseCache.  Use TrbBaseCache as a base class when declaring cache objects.  Properties and methods of TrbBaseCache provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure Add(const S : String; Data : Pointer);


HDescription:
The number of unique words in the cache.  The cache may also be used to store OmitList words, so the value does not necessarily reflect the number of words processed.

Run-time and read only.


HDescription:
Returns the number of words deleted from the cache during the update process.

Run-time and read only.


HDescription:
Returns the number of edits performed on words held in cache.

Run-time and read only.

HExample:
with rbUpdate1, Cache do
 if EditCounter + InsertCounter > 0 then
  begin
   WriteCache;
   ResetCounters
  end;


HDeclaration:
procedure GetMemory(var Data : Pointer; Bytes : LongInt);


HDescription:
Returns the number of words inserted into the cache.

Run-time and read only.

HExample:
with rbUpdate1 do
 if EditCounter + InsertCounter > 0 then
  begin
   WriteCache;
   ResetStats
  end;


HDeclaration:
procedure Iterate(OnIterate : TIterateEvent; FreeData,ClearCache : Boolean);


HDescription:
The maximum value of MemoryUsage.

Run-time and read only.


HDescription:
This property determines how much memory may be used for caching data structures.  Enter the value in kilobytes.  The value of MemoryLimit does not represent how much memory will be used as explained below.

When building large tables, MemoryLimit should be set to approximately the amount of physical RAM minus 8 mb under Win 9x, or half of physical memory under Win NT.  Setting the property to a value that exceeds these guidelines may result in excessive disk swapping, while setting it too low will result in more time spent unnecessarily compressing/decompressing and/or reading/writing of data structures.  Remember, these guidelines are approximations and you may wish to adjust them based on the amount of memory actually used (as reported by NT Task Manager) during a build.

For TrbUpdate, MemoryLimit should be set to a value not exceeding that used by TrbMake.  Generally, TrbUpdate will need much less memory than TrbMake, but update performance improves (especially if DelayedWrites is True) with additional memory.

TrbSearch performance may be enhanced by assigning a modest value to MemoryLimit.  This will allow the component to cache words that frequently appear in searches and therefore eliminate the need to re-read these words from disk.

For TrbMake, if MemoryUsage exceeds MemoryLimit, then the least recently used data structures are compressed.  If all data structures in memory have been compressed, the build process will continue to consume memory beyond MemoryLimit.

For TrbSearch and TrbUpdate, this behavior is the same except that the MemoryLimit is exceeded, indexes are removed from memory.

If the alternative memory manager is being used, the portion of MemoryUsage that represents memory waiting to be reused is not included in the test against MemoryLimit.  See Memory Fragmentation in the documentation for more details.

Default is 1000 (1mb).

HExample:
rbMake1.Cache.MemoryLimit := 20000; { 20mb }


HDescription:
The current amount of memory used to cache data structures.  The value excludes memory used by some container classes, so the actual memory usage is somewhat higher.

Run-time and read only.


HDescription:
Number of words in the cache that have been edited and not written to disk.  Should only be used in conjunction with TrbUpdate.  Calculating ModifiedCount requires iterating through the cache, so this property should be accessed sparingly.

Run time and read only.


HDeclaration:
function Retrieve(const S : String; var OldData,NewData : Pointer;
                     LECounter : LongInt; Insert : Boolean) : Boolean; virtual; abstract;


HDescription:
Root class for the make, update, and search classes.

Do not create instances of TrbEngine.  Use TrbEngine as a base class when declaring engine objects.  Properties and methods of TrbEngine provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Call this method to abort the current process.

HExample:
if GetTickCount - StartTime > 10000 then
 rbSearch1.Abort;


HDescription:
Indicates whether the process has been aborted.

HExample:
with rbSearch1 do
 begin
  TimeLimit := 5000;
  Execute;
  if Aborted then
   MessageDlg('Please be more specific',mtInformation,[mbOk],0)
 end;


HDeclaration:
function AcceptWord(const Word : String) : Boolean;


HDescription:
This property will control the Transliterate property of any fields being indexed and text comparison functions.  When False, performance is improved but international characters may not be handled properly.

Default is True.


HDescription:
This property indicates the TrbBaseCache being used.  This property is required for TrbMake, but is optional (although highly recommended) for TrbUpdate, TrbServerUpdate, and TrbSearch.


HDeclaration:
function iFlush(const Word : String; Data : Pointer; var Delete : Boolean) : Boolean;


HDeclaration:
function iPost(const Word : String; Data : Pointer; var Delete : Boolean) : Boolean;


HDeclaration:
function iPurge(const Word : String; Data : Pointer; var Delete : Boolean) : Boolean;


HDeclaration:
function iUpdate(const Word : String; Data : Pointer; var Delete : Boolean) : Boolean;


HDescription:
Function used to convert words to a 'like' equivalent string.  Two or more words that have the same 'like' string will evaluate as equivalent when using slLike SearchLogic.  The Likeness function must return a string of less than or equal to LikeFieldSize characters.

Default is a modified Soundex routine.  Run-time.


HDescription:
The current Location being processed.  This property should only be set by Rubicon.


HDescription:
Words with a length less than the minimum word length will not be processed by any of the Rubicon components.  A minimum word length of three would therefore exclude words like 'a', 'of', 'we', etc., which are generally not very useful in a search.  Note that it may exclude some useful state (CA, NY), company (3M, TI), and other (PC) abbreviations and words like 'go' and 'hi'. 

Valid values are 1..10.  Default is 1. 

Run-time and read only for all except TrbMake.


HDeclaration:
procedure Notification(AComponent: TComponent; Operation: TOperation);


HDescription:
Assign the list of words to be omitted from the Words.  These words need not be in upper case.  One word per line.  No duplicate words permitted.  Maximum capacity 500 words.

Run-time and read only for all except TrbMake.


HDescription:
Use this event to control which words are processed by the component.  If used, the event must be set for TrbMake, TrbUpdate, TrbClientUpdate, and TrbServerUpdate so that results are consistent.  If OnAcceptWord is used during a make, but not used during an update, a rbeInvalidated error will be raised.

TrbSearch does not have an OnAcceptWord event since the volume of words it deals with is small.  If a rejected word is entered in a search, it will not be found.  To have the word ignored, identify a rejected word in the OnPreviewWord event and set its length to zero.

The Word parameter will be parsed based on the value of WordDelims, will contain at least MinWordLen characters, and by default uppercase.

HExample:
function TForm1.rbMake1AcceptWord(Sender: TObject;
                                  const Word: String): Boolean;
begin
 { Reject words starting with a number }
 Result := not (Word[1] in ['0'..'9'])
end;


HDescription:
This event is called each time State changes.  Since the event is called before the new value is set, the current value of State may be treated as the OldState.

HExample:
procedure TForm1.StateChange(Sender : TObject;
                             NewState : TEngineStates);
begin
 with TrbEngine(Sender) do
  begin
   if (esMake in NewState) and
      not (esMake in State) then
    Caption := 'Building';
   if not (esMake in NewState) and
      (esMake in State) then
    Caption := 'Done'
  end
end;


HDeclaration:
procedure ProcessList(List : TStrings; Parse : Boolean);

HDescription:
The strings contained in List are processed by the component.  If Parse is True, then each string is broken down into single words using WordDelims, otherwise each entry in the List should be an individual word.

The strings or words contained in List should be in the same order as they appear in the field.  Do not attempt to eliminate duplicate words.

ProcessList may only be called from within an OnProcessField event handler.

HExample:
procedure TForm1.rbMakeTextTableLink1ProcessField(Sender: TObject;
                     Engine : TrbEngine; Field: TField);
var       List: TStrings;
begin
 if Field.FieldName = 'Memo' then 
  begin
   List := TStringList.Create;
   try
    List.Assign(Field);
    Engine.ProcessList(List,True)
   finally
    List.Free
   end
  end
 else
  TrbTextDataSetLink(Sender).ProcessField(Engine,Field)
end;

HSee_Also:
OnProcessField, ProcessField, ProcessPChar, ProcessString, ProcessWord


HDeclaration:
procedure ProcessPChar(S : PChar; Bytes : Cardinal);

HDescription:
The words contained in S are added to the processed by the component.  Bytes is the length of S not including the null terminator, if any.  May only be called from within an OnProcessField event handler.

HExample:
procedure TForm1.rbMakeTextTableLink1ProcessField(Sender: TObject;
                           Engine: TrbEngine; Field: TField);
var       S : String;
begin
 if Field.FieldName = 'Memo' then
  begin
   S := Field.AsString;;
   Engine.ProcessPChar(@S[1],Length(S))
  end
 else
  TrbTextDataSetLink(Sender).ProcessField(Engine,Field)
end;

HSee_Also:
OnProcessField, ProcessField, ProcessList, ProcessString, ProcessWord


HDescription:
The words contained in S are added to the processed by the component.  May only be called from within an OnProcessField event handler.

HExample:
procedure TForm1.rbMakeTextTableLink1ProcessField(Sender: TObject;
                              Engine: TrbEngine; Field: TField);
var       S : String;
begin
 if Field.FieldName = 'Memo' then
  begin
   Engine.ProcessString(AsString)
  end
 else
  TrbTextDataSetLink(Sender).ProcessField(Engine,Field)
end;

HSee_Also:
OnProcessField, ProcessField, ProcessList, ProcessPChar, ProcessWord


HDeclaration:
procedure ProcessWord(Word : String; ApplyUpperCase : Boolean);

HDescription:
Word is processed by the component.  No parsing is performed.  If Word is not already uppercase, then ApplyUpperCase should be True.  ProcessWord may only be called from within an OnProcessField event handler.

Call ProcessWord for each word contained in the field and in the same order as they appear in the field.  Do not attempt to eliminate duplicate words.  If the Word is not already uppercase, then set ApplyUpperCase to True.

HExample:
procedure TForm1.rbMakeTextTablbe1ProcessField(Sender: TObject;
                             Field: TField; Location: LongInt);
begin
 if (Field.FieldName = 'Company') and
    (Field.AsString = 'IBM') then 
  with Engine do
   begin
    ProcessWord('IBM',False);
    ProcessWord('International',True);
    ProcessWord('Business',True);
    ProcessWord('Machine',True)
   end
 else
  TrbTextDataSetLink(Sender).ProcessField(Engine,Field)
end;


HDescription:
This property returns the value of the current segment being processed.  The value of Segment will range between zero and IndexRange DIV SegmentSize.

Run-time and read only.


HDescription:
In order to process huge tables, the Rubicon components may divide the TextLink into logical segments.  SegmentSize determines the size of these segments.  This value is set when the WordsLink is first built with and may not be changed without rebuilding the WordsLink.

Each segment of the TextLink can hold up to SegmentSize index positions.  Index positions are explained in the following example: a customer table contains a CustNo field whose value ranges from 1010 to 1200 in increments of 10.  There are a total of 20 records.  The IndexRange is 190 (1200 - 1010).  If SegmentSize is 50, there will be 4 segments with each segment will hold 5 records. 

If the customer table is indexed with an AutoInc field starting at 1, then the IndexRange would be 19 (20 - 1).  With a SegmentSize of 50 there would only be one segment with a capacity of holding 50 records.

The reason for the difference is that the first example uses a very inefficient index - CustNo increments by 10, thereby wasting 9 index positions.  (Note:  processing huge tables with an inefficient index mode is not recommended because it results in excessive memory consumption).

While smaller values for SegmentSize size will result in more segments in the table, it will also require TrbSearch to spend more time reassembling the segments.  As a very general rule of thumb, SegmentSize should be set to between one fourth to one sixteenth of the tables IndexRange.

Values for SegmentSize are rounded up to a value divisible by 16.  Assigning a zero or negative value resets the property to its default.

Default is High(LongInt).

Other than for TrbMake, the property is run-time and read only.


HDescription:
The current state of the component.

Run-time.

HExample:
procedure TForm1.StateChange(Sender : TObject; 
                             NewState : TEngineStates);
begin
 with TrbEngine(Sender) do
  begin
   if (esMake in NewState) and
      not (esMake in State) then
    Caption := 'Building';
   if not (esMake in NewState) and
      (esMake in State) then
    Caption := 'Done'
  end
end;


HDescription:
The TextLink provides the interface or link between the Rubicon engine and the text being processed.  The TextLink generally points to an object that is connected to a DataSet.


HDescription:
Procedure used to convert words to upper case.  Since this routine is called so often, it is critical for performance reasons to make it as efficient as possible.

Case conversion can be turned off by defining your own upper case procedure that performs no case conversion.  If a custom uppercase procedure is used, it must be used in TrbMake, TrbUpdate, TrbClientUpdate, and TrbSearch so that all words are processed consistently. 

Default is rbUtils.FastUpperCase.  Run-time.


HDescription:
These characters define the beginning and end of a word.  Control characters can be entered as ^M and ^J.  To enter a ^, use ^^.  To treat characters chr(0) through chr(31) as delimiters, include <<< in WordDelims. To treat characters chr(128) through chr(255) as delimiters, include >>> in WordDelims.

The most common delimiters are spaces, commas, and periods.  You will probably want to include other punctuation (colon, semi-colon, double quotes, single quotes, question marks, exclamation marks), parentheses, braces, brackets, and mathematical symbols.  

Whether you want to include any of these @#$%&\~ characters depends on your database.

In some instances, you may consider using numbers as word delimiters.  This will effectively eliminate all numbers from the dictionary.

Be aware that the period delimiter causes havoc with numerical values embedded in string or memo fields: a number like '19.95' would become two words:  '19' and '95'.

Word delimiters are not applied to any numerical, boolean, date, or time fields, only to string and memo fields.

Default is ' ,.;:?![]{}()<>/+-*=\|_&#%$@^^~`"''^M^J^I'.

Run-time and read only for all except TrbMake.


HDescription:
The WordsLink provides the interface or link between the Rubicon engine and the storage of words and indices.  The WordsLink generally points to an object that is connected to a DataSet.


HDescription:
Classes which need to call ReadProperties and FlushCache descend from this class.  The class also include the Initialize method which must be called before updates are performed and may be optionally called before searches are performed.

Do not create instances of TrbReadEngine.  Use TrbReadEngine as a base class when declaring search and update objects.  Properties and methods of TrbReadEngine provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Forces any unwritten records in the memory cache to be written to disk and releases the associated memory.  Most useful for applications that are performing searches or updates.


HDescription:
This method should be called before the first update is performed.  It may also be optionally called before the first search (doing so speeds up the first search as the component does not have to initialize itself). 

Initialize can be slow for SQL tables because it has to call a TDataSet.First and TDataSet.Last in order to determine the IndexRange.  See OnMaxIndex and OnMinIndex for alternative ways to handle this.

HExample:
{ Create a new WordsLink }
rbMake1.Execute;
{ Prepare for updating }
rbUpdate1.Initialize;


HDescription:
This method reads the properties which are usually stored in the WordsLink, but does not fully initialize the component.


HDescription:
Most errors returned by Rubicon are ERubicon errors.  Errors occurring in licensed SysTools routines will return EStContainerError errors.


HDescription:
Contains the error code of the exception.  rbConst.pas contains all the error codes and rbConst.rc contains the descriptions.

HExample:
with Table1 do
 try
  Delete
 except
  on E : Exception do
   if (E is ERubicon) and
      (ERubicon(E).ErrorCode = rbeInvalidated) then
    MessageDlg('Invalidated',mtError,[mbOk],0)
   else raise
 end;


HDeclaration:
procedure CheckNil(P : Pointer; ErrorCode : LongInt);


HDescription:
This class implements all WordsLink requirements that can be done with a standard TDataSet.  Those tasks that cannot be implemented are left to descendent classes to handle.

Do not create instances of TrbWordsDataSetLink.  Use TrbWordsDataSetLink as a base class when declaring word link objects.  Properties and methods of TrbWordsDataSetLink provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
This property defines the size of the rbBlob field in the DataSet.  For Paradox tables, higher values increase the size of the DB file and reduce the size of the MB file.  Setting the value too high results in excessive wasted space in the DB file.  Setting it too low causes more data to be saved to the MB file and, because the MB file has to be accessed more frequently, degrades build performance.

Value may not be 1 - 23.  When set, BytesFieldSize and CharFieldSize must be zero. When supported, using BytesFieldSize results in better performance than BlobFieldSize because reading and writing to ftBytes fields is significantly faster than ftBlob fields when the entire contents of the index can fit in the bytes field.

Not applicable to all table types.  Default varies with driver.

HSee_Also:
BytesFieldSize, CharFieldSize, LikeFieldSize, ReverseField, WordFieldSize


HDescription:
This property defines the size of the rbBytes field in the Words table.  If set to zero, then the rbBytes field is not created.  Values between 1 - 23 are not accepted.  Values of 24 and greater result in a ftBytes field being added to the DataSet. 

Like the BlobFieldSize property, higher values increase the number of bytes stored in the record and reduces the number of bytes stored in Blobs (for Paradox tables, this increases the size of the DB file and reduce the size of the MB file).  Setting the value too high results in excessive wasted space in the record structure.  Setting it too low causes more data to be saved in Blobs and, because the Blob has to be accessed more frequently, degrades build performance.

When natively supported, using BytesFieldSize results in better performance than BlobFieldSize because reading and writing to ftBytes fields is significantly faster than an ftBlob field.  This performance gain is achieved for all records where the entire word index can fit in the rbBytes field (indexes larger than BytesFieldSize are split between the rbBytes and rbBlob fields).

This property should not be set for table types that do not natively support the ftBytes field type since the BDE (or equivalent) will convert the field to a Blob equivalent, resulting in two Blob fields per record which is completely unnecessary.  This property is safe to use with Paradox and FlashFiler tables.  It should not be used with dBase and InterBase tables.  The property should also not be used when building a DataSet locally with the intention of moving the table to a server that does not natively support ftBytes.

When set, BlobFieldSize and CharFieldSize must be 0.

Not applicable to all table types.  Default varies with driver.


HDescription:
This property defines the size of the rbChar field in the DataSet.  For tables types that do not support in record storage of binary data via BlobFieldSize or BytesFieldSize, the CharFieldSize offers a workaround by storing binary data in an encoded string field.  If the table type does support in record binary storage, this property should not be used.  

If an index can be entirely stored in record, then the rbBlob field is not used.  Reading and writing the index is usually faster because there is no blob field access.

If not zero, value must be a multiple of 4 and greater than or equal to 32.  When set, BlobFieldSize and BytesFieldSize must be zero. 

Default varies with driver.

HSee_Also:
BlobFieldSize, BytesFieldSize, LikeFieldSize, ReverseField, WordFieldSize


HDeclaration:
function GetDataSetInfo(Index : Integer) : String;


HDeclaration:
function IndexText(Limit : Integer) : String;


HDescription:
Determines the size (or length) of the rbLike field in the DataSet.  Setting LikeFieldSize to zero removes the rbLike field from the DataSet and disables slLike SearchLogic.

Default is 5.

HSee_Also:
BlobFieldSize, BytesFieldSize, CharFieldSize, Likeness, ReverseField, WordFieldSize


HDeclaration:
procedure SetDataSetInfo(Index : Integer; Value : String);


HDescription:
This property may be used to access the DataSet's TableName.  The primary purpose for the property is to specify the TableName when using a TQuery DataSet.


HDescription:
Set this property to a positive value to enable transactions for the WordsLink during index builds and updates.  When used with SQL tables, enabling transactions can reduce index build and update times by as much as 85%.  The component uses the TransIsolation mode of the Database associated with the WordsLink.

When set, the components will start a transaction, perform Transactions adds, edits, and/or deletes, then commit those changes, and repeat this sequence until the operation is complete.

The correct value for Transactions will vary primarily on the server type and available memory.  Higher values improve performance.  A good starting point would be 256.

When performing updates, transactions improve performance most when MemoryLimit is large enough to hold several hundred indexes and DelayedWrites is enabled.

If your application is explicitly using transactions during a table update, and the transactions already include the WordsLink, then this property should be not be enabled.  Under these conditions, DelayedWrites should be False.

Default is 0.


HDescription:
WordFieldSize defines the size of the rbWord field in the DataSet.  Words greater than WordFieldSize will be processed, but they are truncated.  Minimum is 5, maximum is 40.

Default is 20.

HSee_Also:
BlobFieldSize, BytesFieldSize, CharFieldSize, LikeFieldSize, ReverseField


HDescription:
This class implements all the TextLink actions that can be done with a standard TDataSet.  Those tasks that cannot be implemented are left to descendent classes to handle.

Do not create instances of TrbTextDataSetLink.  Use TrbTextDataSetLink as a base class when declaring text link objects.  Properties and methods of TrbTextDataSetLink provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
function Eof : Boolean;
    function GotoLocation(ALocation : LongInt) : Boolean; override;


HDescription:
This is the TField currently being processed.  For instance, in the OnRankWord event this property may be used to determine which field the word being ranked comes from.

Run-time and read only.

HExample:
function TForm1.rbSearch1RankWord(Sender: TObject; const Word: String) : Integer;
begin
 with Sender as TrbEngine, TextLink as TrbTextDataSetLink do
  if Field.FieldName = 'Title' then Result := 2
  else Result := 1
end;


HDescription:
Use this property to control which fields are included in the dictionary.  To include lookup fields from other tables, simply add calculated fields to the DataSet.  If you wish to include blob fields from another table, use the OnProcessField to 'link' the field to the record.

This property must be set for TrbMake and otherwise an error is raised when Execute is called.

Run-time and read only for all except TrbMake.  Default is an empty list meaning no fields have been selected for processing.


HDescription:
This property indicates which field should be used by Rubicon to track the location of the text in the record.  The field must be indexed.  Any ordinal field that is a primary or unique key may be assigned as the IndexFieldName.  An ordinal field has a DataType of ftAutoInc, ftInteger, ftSmallInt, or ftWord. The field's index does not have to have the ixPrimary or ixUnique options, but it must indeed be unique.  The field does not have to be ordinal, but it must resolve to an integer value.

Only single field indexes are displayed in the Delphi Object Inspector.

Run-time and read only for all except TrbMake.


HDescription:
In order to determine how much memory is required to store an index, Rubicon calls the IndexRange property.  The IndexRange, in turn, is determined by calculating the difference between MaxIndex and MinIndex.   Finally, MaxIndex and MinIndex are determined by moving to the first and last records in the DataSet (if a TTable-like DataSet) or by an SQL query (if a TQuery-like DataSet).  Since these operations may be time consuming, and since the requested value may be known ahead of time (e.g. from a generator), this event may be used to override the default behavior and provide the requested value directly.

HExample:
function TForm1.MaxIndex(Sender : TObject) : LongInt;
begin
 OpenGenerator(tblArticles,'CURRENT_ARTNO');
 Result := GeneratorValue(tblArticles)
end;


HDescription:
In order to determine how much memory is required to store an index, Rubicon calls the IndexRange property.  The IndexRange, in turn, is determined by calculating the difference between MaxIndex and MinIndex.   Finally, MaxIndex and MinIndex are determined by moving to the first and last records in the DataSet (if a TTable-like DataSet) or by an SQL query (if a TQuery-like DataSet).  Since these operations may be time consuming, and since the requested value may be known ahead of time (e.g. from a generator), this event may be used to override the default behavior and provide the requested value directly.

In addition, if the first record in index order may be deleted, or if records may be inserted ahead of the first record (again, in index order), this event may be used to 'reserve' some locations ahead of the first record.  Thus, if the first location is 10, returning a value of 1 would reserve locations 1 - 9 for future use and would allow location 10 to be deleted.  If the event is being used with query based drivers, the value returned by the event must not be less than the current minimum index value minus the BlockSize.

HExample:
function TForm1.MinIndex(Sender : TObject) : LongInt;
begin
 Result := 1
end;

HSee_Also:
BlockSize, IndexRange, MaxIndex, MinIndex, OnMaxIndex


HDescription:
Use this event ot implement custom field handling.

The example below shows how to use the OnProcessField event to link a master table to a detail table (Table2) that contains a memo field.  The link field in the master table is named MemoNo.  Table2 is assumed to be open on the MemoNo index.

Be aware that this code should be linked to the OnProcessField event for rbMake1, rbSearch1, and (if used) rbUpdate1.  This is why Sender is cast as TrbTextDataSetLink.

HExample:
procedure TForm1.rbMake1ProcessField(Sender: TObject;
                       Engine : TrbEngine : Field: TField);
var       BlobSize : LongInt;
          Buffer   : PChar;
begin
 if Field.FieldName = 'MemoNo' then
  if Table2.FindKey([Field.AsInteger]) then
   with TBlobStream.Create(TMemoField(Table2.FieldByName('Memo')),
                           bmRead) do
    try
     {$IFDEF WIN32}
     BlobSize := Size;
     {$ELSE}
     BlobSize := MinLong(Size,MaxBlobSize);
     {$ENDIF}
     GetMem(Buffer,BlobSize);
     try
      Read(Buffer^,BlobSize);
      Engine.ProcessPChar(Buffer,BlobSize)
     finally
      FreeMem(Buffer,BlobSize)
     end
   finally
    Free
   end
  else
 else
  TrbTextDataSetLink(Sender).ProcessField(Engine,Field)
end;


HDeclaration:
procedure ProcessField(Engine : TrbEngine; Field : TField);

HDescription:
Use this method to implement custom field handling.  ProcessField may only be called from within an OnProcessField event handler.

HExample:
procedure TForm1.rbMake1ProcessField(Sender: TObject;
              Engine : TrbEngine; Field: TField);
begin
 if (Field.FieldName = 'Company') and
    (Field.AsString = 'IBM') then 
  with Engine do
   begin
    ProcessWord('IBM');
    ProcessWord('International');
    ProcessWord('Business');
    ProcessWord('Machine');
   end
 else
  TrbTextDataSetLink(Sender).ProcessField(Engine,Field)
end;


HDescription:
By default searches are conducted against all the fields included FieldNames.  However, SubFieldNames can be used to search against a subset of fields (searches may not be conducted on fields not in FieldNames without rebuilding the WordsLink).  When SubFieldNames is not empty, the search is further narrowed to the field names included in SubFieldNames.  

Using SubFieldNames forces all searches to read the DataSets, and therefore slows the search process.  Before any reads take place, the words in the search and the SearchLogic are used to narrow the list of possible records.  This means that fairly specific searches will only read a small number of records, and search performance will remain fast.

However, very broad searches, and especially searches containing slNot SearchLogic (which will be forced to read each record of the DataSet), will have their performance adversely affected.   You may want to use the TimeLimit property to limit the time spent performing the search and advise the user to take a different approach to the search.

An application that uses SubFieldNames frequently will likely achieve better search performance if instead of using a single Words table, employed multiple Words tables, one each for the field(s) being assigned to SubFieldNames.


HDeclaration:
procedure CheckDataSet(DataSet : TDataSet; Active : Boolean; Error : LongInt);


HDeclaration:
procedure DriverClear(DataSet : TDataSet; DeleteExisting : Boolean);


HDeclaration:
procedure DriverExclusive(DataSet : TDataSet; Value : Boolean);


HDeclaration:
procedure DriverTransaction(DataSet : TDataSet; Action : Integer);


HDeclaration:
TrbCustomWordsTableLink
TrbWordsBaseTableLink
TrbWordsDataSetLink
TrbWordsLink
TrbBase

HDescription:
This class implements all the WordsTableLink logic, but does not publish any properties.  Link classes provide the basic interface between a core Rubicon component (e.g. TrbMake, TrbSearch) and the storage class, in this case a database table accessed via a TTable component.

Do not create instances of TrbCustomWordsTableLink.  Use TrbCustomWordsTableLink as a base class when declaring table objects.  Properties and methods of TrbCustomWordsTableLink provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure Properties(Stream : TStream ; Mode : TBlobStreamMode);


HDeclaration:
TrbMakeWordsTableLink
TrbCustomWordsTableLink
TrbWordsBaseTableLink
TrbWordsDataSetLink
TrbWordsLink
TrbBase

HDescription:
This is a TrbWordsDataSetLink derived component that acts as the link or driver for TrbMake to store words in a database table via a TTable component.


HDeclaration:
TrbWordsTableLink
TrbCustomWordsTableLink
TrbWordsBaseTableLink
TrbWordsDataSetLink
TrbWordsLink
TrbBase

HDescription:
This is TrbWordsDataSetLink derived component that acts as the link or driver to a TTable by TrbUpdate, TrbServerUpdate, and TrbSearch.


HDeclaration:
TrbCustomTextTableLink
TrbTextBaseTableLink
TrbTextDataSetLink
TrbTextLink
TrbBase

HDescription:
This class implements all the TextTableLink logic, but does not publish any properties.  Link classes provide the basic interface between a core Rubicon component (e.g. TrbMake, TrbSearch) and the storage class, in this case a database table accessed via a TTable component.

Do not create instances of TrbCustomTextTableLink.  Use TrbCustomTextTableLink as a base class when declaring table link objects.  Properties and methods of TrbCustomTextTableLink provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Table that contains the text to be indexed.


HDeclaration:
TrbTextTableLink
TrbCustomTextTableLink
TrbTextBaseTableLink
TrbTextDataSetLink
TrbTextLink
TrbBase

HDescription:
This is TrbTextDataSetLink derived component that acts as the link or driver to a TTable by TrbUpdate, TrbServerUpdate, and TrbSearch.


HDeclaration:
TrbMakeTextTableLink
TrbCustomTextTableLink
TrbTextBaseTableLink
TrbTextDataSetLink
TrbTextLink
TrbBase

HDescription:
This is a TrbTextDataSetLink derived component that acts as the link or driver to a TTable by TrbMake.


HDeclaration:
procedure AssignTable(Table : TTable; FileName : String);


HDeclaration:
procedure ClearTable(DataSet : TDataSet; DeleteExisting : LongInt);


HDeclaration:
procedure CreateTable(DataSet : TDataSet; Param : LongInt);


HDeclaration:
procedure Exclusive(DataSet : TDataSet; Param : LongInt);


HDeclaration:
function IsAliasParam(Alias,Param,Value : String) : Boolean;


HDeclaration:
procedure OpenTable(Table : TTable; FileName : String);


HDeclaration:
function TableExists(Table : TTable) : Boolean;


HDeclaration:
procedure TableTransaction(DataSet : TDataSet; Param : LongInt);


HDeclaration:
TrbCustomWordsQueryLink
TrbWordsSQLLink
TrbWordsDataSetLink
TrbWordsLink
TrbBase

HDescription:
This class implements all the WordsQueryLink logic, but does not publish any properties.  Link classes provide the basic interface between a core Rubicon component (e.g. TrbMake, TrbSearch) and the storage class, in this case a database table accessed via a TQuery component.  

Do not create instances of TrbCustomWordsQueryLink.  Use TrbCustomWordsQueryLink as a base class when declaring query objects.  Properties and methods of TrbCustomWordsQueryLink provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
TrbMakeWordsQueryLink
TrbCustomWordsQueryLink
TrbWordsSQLLink
TrbWordsDataSetLink
TrbWordsLink
TrbBase

HDescription:
This is a TrbWordsDataSetLink derived component that acts as the link or driver for TrbMake to store words in a database table via a TQuery component.  This component should only be used with SQL based databases.  To store words in a local tables, use a TTable based link.


HDeclaration:
TrbWordsQueryLink
TrbCustomWordsQueryLink
TrbWordsSQLLink
TrbWordsDataSetLink
TrbWordsLink
TrbBase

HDescription:
This is TrbWordsDataSetLink derived component that acts as the link or driver for core Rubicon components (e.g. TrbUpdate, TrbSearch, but not TrbMake) to access words stored in a database table via a TQuery component.  This component should only be used with SQL based databases.  To access local tables, use a TTable based link.

In order to perform wildcard searches, the component translates the wildcards into an SQL LIKE equivalent statement.  This generally works well, but there is the potential that such a query could return a very large number of matching words.  Unlike the table datasets which perform a scan that can be interrupted, the query cannot be interrupted.  You may wish to use the OnPreviewWord event to catch vague wildcard searches like "a*" before they execute.

The TQuery assigned to the Query property need not have any SQL statements in it's SQL property.

This component does not support TrbHints.


HDeclaration:
TrbCustomTextQueryLink
TrbTextSQLLink
TrbTextDataSetLink
TrbTextLink
TrbBase

HDescription:
This class implements all the TextQueryLink logic, but does not publish any properties.  Link classes provide the basic interface between a core Rubicon component (e.g. TrbMake, TrbSearch) and the storage class, in this case a database table accessed via a TQuery component.  

Do not create instances of TrbCustomTextQueryLink.  Use TrbCustomTextQueryLink as a base class when declaring query objects.  Properties and methods of TrbCustomTextQueryLink provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Query used to access the text being indexed.  Be sure to set the DatabaseName property.

HExample:
with rbTextQueryLink1 do
 begin
  Query := Query1;
  TableName := 'customer'
 end;


HDeclaration:
TrbTextQueryLink
TrbCustomTextQueryLink
TrbTextSQLLink
TrbTextDataSetLink
TrbTextLink
TrbBase

HDescription:
This is TrbTextDataSetLink derived component that acts as the link or driver for core Rubicon components (e.g. TrbUpdate, TrbSearch, but not TrbMake) to access text stored in a database table via a TQuery component.  This component should only be used with SQL based databases.  To access local tables, use a TTable based link.

The TQuery assigned to the Query property need not have any SQL statements in it's SQL property.


HDeclaration:
TrbMakeTextQueryLink
TrbCustomTextQueryLink
TrbTextSQLLink
TrbTextDataSetLink
TrbTextLink
TrbBase

HDescription:
This is a TrbTextDataSetLink derived component that acts as the link or driver for TrbMake to access text stored in a database table via a TQuery component.  This component should only be used with SQL based databases.  To access local tables, use a TTable based link.


HDeclaration:
procedure AddCheck(const Name : String; Data : Pointer);


HDeclaration:
procedure FastAdd(const Name : String; Data : Pointer);


HDeclaration:
function FastExists(const Name : String; var Data : Pointer) : Boolean;


HDeclaration:
procedure FastUpdate(const Name : String; Data : Pointer);


HDescription:
This class implements all the caching logic, but does not publish any properties.

Do not create instances of TrbCustomCache.  Use TrbCustomCache as a base class when declaring cache objects.  Properties and methods of TrbCustomCache provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure GetCacheStats(var CS : TCacheStats);


HDeclaration:
function Retrieve(const S : String; var OldData,NewData : Pointer;
                     LECounter : LongInt; Insert : Boolean) : Boolean; override;


HDescription:
This class is used store words and their indices in memory.  The cache may only store information from one WordsLink.  It may not be used to store information from multiple WordsLinks.

The cache may be shared between Rubicon components when they are all accessing the same WordsLink, the WordsLink is not segmented, and they are all in the same thread.  When the WordsLink is segmented, only like Rubicon components can share the cache (e.g. rbSearch1 could share with rbSearch2, but rbSearch1 could not share with rbUpdate1).

See documentation for information on threading and shared caching.


HDescription:
This class implements all the make logic, but does not publish any properties.

Do not create instances of TrbCustomMake.  Use TrbCustomMake as a base class when declaring make objects.  Properties and methods of TrbCustomMake provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Use this property to limit the build to the first CounterLimit records for testing purposes.  A zero value indicates no record limit.

Default is 0.


HDescription:
Builds a new WordsLink based on the contents of TextLink.  The TextLink should not be updated during the build process.

The execution process consists of two phases: A reading phase which reads text from the TextLink builds a list of words and their locations in memory using the Cache property.  During this phase, memory consumption grows.  This is followed by a writing phase which writes the in memory data to WordsLink and releases memory used in the reading phase.  Memory usage is controlled by the Cache.MemoryLimit property.

The TextLink and WordsLink objects contain properties that indicate how much progress has been made.  The TrbProgressDialog is a convenient way to display the components progress.

The number of records processed can be limited by using CounterLimit.

HExample:
Screen.Cursor := crHourGlass;
with rbMake1 do
 try
  Cache.MemoryLimit := 8000; { 8mb }
  MinWordLen := 3;
  with TextLink as TrbMakeTextTableLink do
   begin
    FieldNames.Clear;
    FieldNames.Add('Customer');
    FieldNames.Add('Notes');
   end;
  Execute
 finally
  Screen.Cursor := crDefault;
 end;

HSee_Also:
Cache, CounterLimit, TextLink, TrbProgressDialog, WordsLink


HDescription:
When processing huge tables, the FirstSegment and LastSegment properties may be used to assign a portion of the task to a single application or thread.  By doing so, the entire task can be spread across multiple computers or processors.

For instance, building a WordsLink for a TextLink with an IndexRange of one million and using a SegmentSize of 32,000 would mean there are 32 segments to process.  Using four computers (or four threads running on a single computer), the first computer could process segments 0 - 7, the second 8 - 15, and so on.  Each computer or thread would create its own WordsLink.  Upon completion, the four WordsLinks would be combined by adding them together using TBatchMove or equivalent.

When splitting a task with this property, the application must be sure to process all the segments.

Default is 0.  Value must be greater than or equal to zero and less than or equal to LastSegment.

HExample:
rbMake1.FirstSegment := 0;
rbMake1.LastSegment := 1;
rbMake1.Execute;
rbMake2.FirstSegment := 2;
rbMake2.LastSegment := 3;
rbMake2.Execute;
BatchMove1.Source := WordsTable1;
BatchMove1.Destination := WordsTable2;
BatchMove1.Mode := batAppendUpdate;
BatchMove1.Execute;


HDescription:
When processing huge tables, the FirstSegment and LastSegment properties may be used to assign a portion of the task to a single application or thread.  By doing so, the entire task can be spread across multiple computers or processors.

For instance, building a WordsLink for a TextLink with an IndexRange of one million and using a SegmentSize of 32,000 would mean there are 32 segments to process.  Using four computers (or four threads running on a single computer), the first computer could process segments 0 - 7, the second 8 - 15, and so on.  Each computer or thread would create its own WordsLink.  Upon completion, the four WordsLink would be combined by adding them together using TBatchMove or equivalent.

When splitting a task with this property, the application must be sure to process all the segments.

Default is High(SmallInt).  Value must be greater than or equal to FirstSegment.


HDeclaration:
procedure MakeProperties;
 procedure ProcessWord(Word : String; ApplyUpperCase : Boolean); override;.


HDescription:
The TrbMake component is used to index the TextLink.  The component compiles a dictionary of all the words used in the TextLink and their locations and saves the results in the WordsLink.  

Use the Execute method to build the dictionary.  Execution is divided into a reading and writing phase.  During the reading phase, the text is read from the TextLink and an in-memory dictionary of words and locations is built.  This is a memory intensive operation and there are several Cache properties to help control resource consumption.  The writing phase writes the dictionary to the WordsLink.   

By default, all words are converted to upper case using the rbUtils.FastUpperCase procedure.  This behavior may be overridden by setting the UpperCase property.  What constitutes a word is determined by MinWordLen and WordDelims.

The in memory dictionary is stored in the Cache.  The size of the cache is controlled by Cache.MemoryLimit.


HDescription:
Implements the routines for Words conversion.  Since this component descends from TrbCustomMake, the link components attached to TextLink and WordsLink must have the Make prefix.

Do not create instances of TrbCustomConvert.  Use TrbCustomConvert as a base class when declaring convert objects.  Properties and methods of TrbConvert provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
The convert object will use Engine as the source for the Words to be converted.


HDescription:
Call this method to start the conversion process.


HDeclaration:
procedure WriteRecord(const Word,Like : String; SBits,DBits : TrbBits; SW : TrbWordsLink);


HDeclaration:
TrbConvert
TrbCustomConvert
TrbCustomMake
TrbEngine
TrbBase

HDescription:
This class may be used to convert a Words table from one record structure to another.  The most common use is to convert a segmented Words table into a non-segmented one, or visa versa.  It may also be used to change certain field widths such as BlobFieldSize, BytesFieldSize, or CharFieldSize.  The SegmentSize may also be changed.


HDescription:
This class is the root for all update components.

Do not create instances of TrbBaseUpdate.  Use TrbBaseUpdate as a base class when declaring update objects.  Properties and methods of TrbBaseUpdate provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Notification called after a batch operation.

HExample:
rbUpdate1.AfterBatch := rbUpdate1AfterBatch;
...
procedure TForm1.rbUpdate1AfterBatch(Sender: TObject);
begin
 MessageBeep(0)
end;


HDescription:
Insert this method into the DataSet event of the same name so that TrbUpdate can be notified of changes and thereby keep the WordsLink synchronized with the TextLink.

The purpose of this method is to check for invalid deletions, and if one is identified, to raise an error.

When IndexFieldName is set, any record may be deleted except the first record (in index order) unless OnMinIndex has been used.

HExample:
procedure TForm1.Table1AfterDelete(DataSet: TDataSet);
begin
 rbUpdate1.AfterDelete
end;

HSee_Also:
AfterPost, BeforeDelete, BeforeEdit, BeforeInsert, OnMinIndex, TrbTable


HDescription:
Insert this method into the DataSet event of the same name so that TrbUpdate can be notified of changes and thereby keep the WordsLink synchronized with the TextLink.

This method assumes that the record will still be available after the post.  If a range or filter is in place that may cause the record to become unavailable after it is posted, then it will be necessary to place this method in the DataSet.BeforePost event.  However, if the post fails, then the WordsLink will be corrupted.  This approach also assumes that all the fields being indexed have been assigned (e.g. no AutoInc field or fields assigned values from a StroredProc).

HExample:
procedure TForm1.Table1AfterPost(DataSet: TDataSet);
begin
 rbUpdate1.AfterPost
end;

HSee_Also:
AfterDelete, BeforeDelete, BeforeEdit, BeforeInsert, TrbTable


HDescription:
Whenever multiple records are added to the TextLink using TBatchMove, copy, or equivalent command that bypasses the DataSet.Post method, the WordsLink can be updated by moving the cursor to each added record and calling BatchAdd.

HExample:
with Table1 do
 begin
  Last;
  BM := GetBookmark;
  { add the records }
  GotoBookmark(BM);
  FreeBookmark(BM);
  Next;
  while not Eof do
   begin
    rbUpdate1.BatchAdd;
    Next
   end
 end;


HDescription:
Whenever multiple records are deleted from the TextLink using TBatchMove, subtract, or equivalent command that bypasses the DataSet.Post method, the WordsLink can be updated by moving the cursor to each record to be deleted and calling BatchDelete, and then performing the delete.

HExample:
with Table1 do
 begin
  BM := GetBookmark;
  while not Eof do
   begin
    rbUpdate1.BatchDelete;
    Next
   end;
  GotoBookmark(BM);
  FreeBookmark(BM);
  { delete records from current location to Eof }
 end;


HDescription:
Insert this method into the DataSet event of the same name so that TrbUpdate can be notified of changes and thereby keep the WordsLink synchronized with the TextLink.

HExample:
procedure TForm1.Table1BeforeDelete(DataSet: TDataSet);
begin
 rbUpdate1.BeforeDelete
end;

HSee_Also:
AfterDelete, AfterPost, BeforeEdit, BeforeInsert, TrbTable


HExample:
procedure TForm1.Table1BeforeEdit(DataSet: TDataSet);
begin
 rbUpdate1.BeforeEdit
end;

HSee_Also:
AfterDelete, AfterPost, BeforeDelete, BeforeInsert, TrbTable


HDescription:
Insert this procedure into the DataSet event of the same name so that TrbUpdate can be notified of changes and thereby keep the WordsLink synchronized with the TextLink.

HExample:
procedure TForm1.Table1BeforeInsert(DataSet: TDataSet);
begin
 rbUpdate1.BeforeInsert
end;

HSee_Also:
AfterDelete, AfterPost, BeforeDelete, BeforeEdit, TrbTable


HDeclaration:
procedure ReadProperties;
 procedure ProcessWord(Word : String; ApplyUpperCase : Boolean); override;.


HDeclaration:
procedure UpdateWord(const Word : String; Adding : Boolean);


HDeclaration:
TrbCustomUpdate
TrbBaseUpdate
TrbReadEngine
TrbEngine
TrbBase

HDescription:
This class implements all the update logic, but does not publish any properties.

Do not create instances of TrbCustomUpdate.  Use TrbCustomUpdate as a base class when declaring update objects.  Properties and methods of TrbCustomUpdate provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
This method iterates through all the Words and clears the locations that are set in Locations.


HDescription:
Setting this property to True enables delayed writes.  This means that changes to the WordsLink are not written to disk until the cache is full, WriteCache, or FlushCache are called.  Turning this property off causes any unwritten records to be written.  If set to True, be sure to call WriteCache before shutdown.

Use this property to speed up the updating process.  When the cache is full, the least recently used records are written to the WordsLink.  When the cache is periodically written to disk, your application may appear to stall.  The AfterPost event of the Text link is called during the writing process and may be used to alert the user of the processing.

Searches conducted against the TextLink while using DelayedWrites may not return current results as pending changes may not have been written to disk.  This property should be disabled if the application may need to rollback a transaction.

Default is False.

HSee_Also:
AfterPost, DeleteCounter, EditCounter, FlushCache, InsertCounter, WriteCache


HDescription:
Forces any unwritten records in the memory cache to be written to disk.

HExample:
with rbUpdate1 do
 if EditCounter + InsertCounter > 0 then
 begin
   WriteCache;
   ResetStats
  end;

HSee_Also:
DelayedWrites, EditCounter, FlushCache, InsertCounter, ResetStats


HDeclaration:
TrbUpdate
TrbCustomUpdate
TrbBaseUpdate
TrbReadEngine
TrbEngine
TrbBase

HDescription:
The TrbUpdate component may be used to keep the WordsLink synchronized with it's TextLink.  Alternatively, the WordsLink may by kept synchronized be simply rebuilding the WordsLink with TrbMake.  The tradeoffs of these two approaches is discussed in TrbMake versus TrbUpdate in the documentation.

For TrbUpdate to work, it needs to be notified when TextLink has been changed via a delete, insert/append, or edit.  The simplest way to do this is to use the TrbTable component.  This may also be accomplished by adding the TrbUpdate routines AfterDelete, AfterPost, BeforeDelete, BeforeEdit, and BeforeInsert into the TextLink's DataSet events of the same name.

Performance can be improved by allocating memory for caching.  This is controlled by the using a Cache component and setting its MemoryLimit property to an appropriate value.  The cache memory stores records that have already been read.  By setting the DelayedWrites property to True, writing records to disk is postponed until a call to FlushCache, Free, or WriteCache.  Searches against the tables should not be conducted while DelayedWrites is enabled unless steps are taken to write the cache immediately before a search.  Note that caching is optional, but highly recommended.

Because the Cache is a separate from the update engine and WordsLink, be sure to check that all the records have been written before shutting down the application.  This can be done by calling the WriteCache method.

Resource usage and performance may be monitored with the following properties available in TrbUpdate itself or in Cache, TextLink, and/or WordsLink: BlobBytesRead, BlobBytesWritten, EditCounter, InsertCounter, DeleteCounter, MaxMemUsed, MemoryUsage, etc.  Many of these may be reset by calling the appropriate ResetCounters method.


HDeclaration:
TrbClientUpdate
TrbBaseUpdate
TrbReadEngine
TrbEngine
TrbBase

HDescription:
TrbClientUpdate is a network replacement for TrbUpdate designed to be used when a common TextLink is being edited on a file server by multiple simultaneous users.   

TrbClientUpdate is used in conjunction with a TrbServerUpdate.  TrbServerUpdate usually runs in a separate application running on a server.  File sharing must be enabled.  For the BDE using local tables, this means setting LocalShare to True.


HDescription:
When True, IsCurrent indicates that the TrbServerUpdate has processed all the words in the NetDataSet.

Run-time and read only.

HExample:
if not rbClientUpdate1.IsCurrent then
 MessageDlg('Updates are still pending.  Proceed?',
		mtConfirmation, mbOkCancel, 0);


HDescription:
Instead of directly updating the WordsLink for changes to the TextLink, TrbClientUpdate writes changes to the NetDataSet.  All clients updating the TextLink write to the same NetDataSet.  These changes are then read by TrbServerUpdate which, in turn, performs the appropriate update to the WordsLink.

NetDataSet is usually (varies by table type) an unindexed table consisting of the following fields:

1. rbWord	Char(WordFieldSize)
2. rbLocation	Integer (4 byte) Record location
3. rbUserID 	SmallInt (optional UserID of client)
4. rbStatus	Integer (4 byte)

The rbWord field contains the word being updated.  The rbLocation field indicates the location or record index of the word being updated.  If positive, rbWord is added to the WordsLink.  If negative, rbWord is deleted from the WordsLink.  The rbStatus field indicates the status of the change: 0 indicates the rbWord has not been processed, otherwise the value represents the tick count of when the change was processed (used as a performance timestamp).  Negative values indicate the TrbServerUpdate component has reached an idle state and has finished processing and saving all changes.  

If all of the records have a non-zero rbStatus, then the NetDataSet may be emptied.

Records are appended to NetDataSet by one or more clients using TrbClientUpdate.  Records are processed by TrbServerUpdate on a FIFO (first in, first out) basis.


HDescription:
Optional property used to indicate which user is updating the NetDataSet.


HDeclaration:
TrbServerUpdate
TrbCustomUpdate
TrbBaseUpdate
TrbReadEngine
TrbEngine
TrbBase

HDescription:
TrbServerUpdate is a component that acts as a centralized TrbUpdate by processing all the changes to the TextLink made by clients using TrbClientUpdate. 

Client applications using TrbClientUpdate do not update the WordsLink directly.  Instead, they notify the application running TrbServerUpdate of changes via records they append to the NetDataSet.  

To initiate this process, the application running TrbServerUpdate calls Execute.  Execute puts the component in a loop where it continually checks the state of the NetDataSet.  If the NetDataSet contains unprocessed records, it proceeds to process them.  If there are no unprocessed records, the component enters an idle state of Interval ticks, after which it checks if there are any unprocessed records, and the cycle begins again.

Use the OnProcess event to be notified when processing is being performed.  To exit the Execute loop, call Abort.

In order to minimize network traffic, the Text table, Words table, NetDataSet, and the application using TrbServerUpdate should be run on the same computer.

If the NetDataSet does not exist, it is created.  Records should be purged from NetDataSet periodically.  Any record with a non-zero Status field may be deleted.  If all the records have a non-zero Status field, the table may be emptied.

When using a Cache (and especially if DelayedWrites is true), be sure to call WriteCache before shutting down the application so that any unwritten words are written to disk.

File sharing may need to be enabled.  For BDE applications using local tables, this means LocalShare must be set to true in the BDE Configuration utility.  

If the Words table is rebuilt with TrbMake, the NetDataSet should be deleted or emptied.

See the Server application for an example of how this component is used.


HDescription:
Calling this method starts the updating process.  The component creates the NetDataSet (if necessary), move to the first unprocessed record and begins performing updates.  If no unprocessed records exist, the component enters an idle state with a timer set to check the NetDataSet every Interval ticks.

You will generally want to have entered the Execute loop before any clients try to access the NetDataSet.  If the NetDataSet does not exist, Execute must be called before any clients perform an update in order to create this table.  If the application running TrbServerUpdate terminates, or clients perform an update to the NetDataSet while TrbServerUpdate is not running, changes will accumulate in the NetDataSet that can be processed as soon as Execute is restarted.

To exit the Execute loop, call Abort as shown in the example.

HExample:
procedure TServerForm.ExecuteBtnClick(Sender: TObject);
begin
 with Sender as TButton do
 if Caption = 'Process' then
   begin
    Caption := 'Stop';
    rbServerUpdate1.Interval := 1000;
    rbServerUpdate1.Execute
   end
 else
   begin
    Caption := 'Execute';
    rbServerUpdate1.Abort
   end
end;


HDescription:
This property determines how often the component checks to see whether there are any pending updates to perform.  If there are pending updates, they are all processed, and then the component uses a timer to control how often to check for any additional updates.

Default is 1000.

HExample:
rbServerUpdate1.Interval := 5000; { 5 seconds }


HDescription:
If assigned, this event is called during the Execute loop.

HExample:
procedure TForm1.rbServerUpdate1Process(Sender: TObject);
var       RecNo,RecCount: LongInt;
begin
 rbUpdateDialog1.UpdateStats;
 RecCount := NetDataSet.RecordCount;
 if NetDataSet.EOF then RecNo := RecCount
 else
  {$IFDEF WIN32}
  RecNo := NetDataSet.RecNo;
  {$ELSE}
  RecNo := GetSeqNo(NetDataSet);
  {$ENDIF}
 ProgressLabel.Caption := IntToStr(RecNo) + ':' + IntToStr(RecCount)
end;

rbServerUpdate1.OnProcess := rbServerUpdateProcess;


HDeclaration:
TrbCustomAppend
TrbBaseUpdate
TrbReadEngine
TrbEngine
TrbBase

HDescription:
Implements the append logic.

Do not create instances of TrbCustomAppend.  Use TrbCustomAppend as a base class when declaring append objects.  Properties and methods of TrbCustomAppend provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Runs the append process on a non segmented WordsLink.  The append process starts at the StartLocation and continues to the end of the TextLink.


HDeclaration:
function iAppend(const Word : String; Data : Pointer; var Delete : Boolean) : Boolean;


HDescription:
The append process will start at this location and process until it reaches the EOF.  The StartLocation must exist.


HDeclaration:
TrbAppend
TrbCustomAppend
TrbBaseUpdate
TrbReadEngine
TrbEngine
TrbBase

HDescription:
This component is designed to efficiently update very large non-segmented words tables when new records are appended to the Text source.

Generally, TrbUpdate is used to update Words when the Text changes.  TrbUpdate can handle deletes, edits, and inserts for non-segmented and segmented Words.  However, in some specialized circumstances it may be desirable to maintain a non-segmented Words table against a very large Text source.  With each word having a very large index, TrbUpdate would be slow under these conditions as it could only cache a limited number of words.  In addition, if text is only being added (no edits, no deletes), then it becomes unnecessary to read the existing indexes during processing.  Instead, TrbAppend can just process the added text as if it were an individual segment.  When finished, TrbAppend reads the existing index and appends the new index data to it.

If the amount of text being added is small, it is best to use TrbUpdate.


HDescription:
This is the lowest level search class.  It implements basic search capabilities.  

Do not create instances of TrbBasicSearch.  Use TrbBasicSearch as a base class when declaring search objects.  Properties and methods of TrbBasicSearch provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure DoPreviewWord(var S : String);


HDescription:
Performs the search based on the values of the SearchFor, SearchLogic, and SearchMode properties.

HExample:
with rbSearch1 do
 begin
  SearchFor := 'Inprise';
  SearchLogic := slAnd;
  SearchMode := smSearch;
  Execute
 end;


HDeclaration:
function GetCacheBits(const Word : String) : Boolean;


HDescription:
MatchBits is a bit set class derived from TurboPower's TStBits, part of SysTools.  Because other routines encapsulate the most common TtaBits methods (see See Also), an application will rarely have to rely on this property directly.

Run-time and read only.

HExample:
with rbSearch1 do
 begin
  Location := MatchBits.FirstClear;
  while Location <> -1 do
   begin
    rbTextTableLink1.Table.FindKey([Location + MinIndex]); 
    { do something with the record }
    Location := MatchBits.NextClear(Location)
   end
 end;

HSee_Also:
FindFirst, FindLast, FindNext, FindPrior, Matches, MinIndex


HDescription:
Number of records matching the search criteria.

Run-time and read only.

HExample:
with rbSearch1 do
 if MatchCount < 100 then 
  rbMatchMaker1.Execute;


HDescription:
Returns a List containing the matching locations.  For DataSets, this list is comprised of the value of the IndexFieldName for the matching records.

HExample:
with rbSearch1 do
 begin
  Execute;
  if MatchCount > 0 then
   begin
    List := TList.Create;
    try
     rbSearch1.MatchingLocations(List);
     ...
    finally
     List.Free
    end
   end
 end;


HDeclaration:
procedure MatchingWord(const S : String);


HDescription:
Number of words that match the search criteria.  For instance, the search for 'Win*' may return win95, window, windows, winner, winnt, and wins, so MatchingWordCount would be six.  A list populated by MatchingWords will return MatchingWordCount words.

MatchingWordCount is cumulative over successive searches if the SearchMode is not smSearch.  If a smNarrow search is executed after a smSearch search, and the MatchingWordCount increases, then new words were found.

For the number of matching words for the last search, use WordCount.

Run-time and read only.

HExample:
if rbSearch1.MatchingWordCount >= 20 then
 MessageDlg('Please narrow search further',mtInformation,[mbOk],0);


HDescription:
Returns a list of words matched during the search.  If only slAnd, slNear, and slPhrase SearchLogic are used without wildcards, then all the words in the list will be in each matching record.  If other types of SearchLogic are used, or wildcards, then only a subset of words in the list will be in each matching record.  Words matched using slNot will never appear in the matching records.

HExample:
with rbSearch1 do
 begin
  SearchLogic := slOr;
  SearchFor := 'Win*';
  Execute;
  MatchingWords(ListBox1.Items); { Returns Win95, Windows, WinNT }
 end;


HDescription:
This event is called before each word is processed in the search.  The example below uses the event to append a wildcard to all words that do not already contain a wildcard, thereby automatically expanding the scope of the search.

This event is not called for the operator tokens when SearchLogic is slExpression (e.g. AND, OR, NOT, NEAR, and LIKE).

HExample:
rbSearch1.OnPreviewWord := rbSearch1PreviewWord;

procedure TForm1.rbSearch1PreviewWord(Sender: TObject;
		                      var Word: String);
begin
 with TrbSearch(Sender) do
  if (pos(AnyChar,Word) = 0) and
     (pos(OneChar,Word) = 0) then
   Word := Word + AnyChar
end;


HDescription:
This event is called while the search is being performed and provides an opportunity to abort a lengthy search.

For instance, some wildcard searches will require that the entire WordsLink to be scanned (e.g. a search for '*fish' would require the entire table to be scanned, whereas 'tuna*' would require only those words beginning with 'tuna' to be scanned).  This event is called during the scan to give the application an opportunity to abort the scan by calling Abort.

Another time consuming task is the process of reading the TextLink when the SearchLogic is slNear or slPhrase, or when SubFieldNames is used.  Here, OnSearch is called with a State included esScanning, or esLocating.

The TimeLimit property may be used to limit the length of the search.  Since ranking may occur after a search is complete, use the OnRankWord event to abort while ranking.

HExample:
procedure TMainForm.rbSearch1Search(Sender: TObject);
begin
 Application.ProcessMessages;
 if not FContinue then
  with rbSearch1 do
   Abort
end;

HSee_Also:
Abort, OnRankWord, RankTime, SearchTime, TimeLimit


HDescription:
This event is called when the search times out.  If this property is not set, the search is aborted.

HExample:
procedure TForm1.rbSearch1Timeout(Sender: TObject);
begin
 MessageBeep(0);
 rbSearch1.Abort
end;


HDescription:
If SearchLogic is slExpression, then SearchFor contains the expression to be evaluated, otherwise it contains the words to search for.

HExample:
with rbSearch1 do
 begin
  SearchFor := Edit1.Text;
  SearchLogic := slAnd;
  SearchMode := smSearch;
  Execute
 end;


HDescription:
There are eight search types:  slAnd, slPhrase, slLike, slNear, slOr, slNot, slExpression, and slSmart.  slAnd searches for records that contain all instances of the words in the SearchFor property. slPhrase searches for words in a specific order of appearance.  slLike searches for words that evaluate as the same using the Likeness function (wildcards are ignored).  slNear searches for two or more words that are within NearWord words of one another.  slOr searches for records that contain at least one instance of the words in the SearchFor property.  

slNot selects all records that do not contain instances of the words in the SearchFor property.  slNot should only be used to narrow an existing search, not to start a new search.

slExpression enables expression evaluation using AND, OR, NOT, LIKE, NEAR, "quoted phrase searches", and parentheses.  For more information on this type of search, see Expression Evaluation in the documentation.

slSmart first tries to process a search using slExpression SearchLogic.  If this search raises an exception and if it appears that the search was intended to be a slExpression search (e.g. the search included the word(s) AND, OR, NOT, LIKE, NEAR, and/or parentheses), then an error is raised.  Otherwise, the search is retried as a slAnd search.

HExample:
with rbSearch1 do
 begin
  SearchFor := Edit1.Text;
  SearchLogic := slOr;
  SearchMode := smSearch;
  Execute
 end;


HDescription:
Returns the length of the search in milliseconds (1000 milliseconds = 1 second).

Run-time and read only.

HExample:
with rbSearch1 do
 ElapsedTimeLable.Capition := Format('1.1f',[SearchTime / 1000.0]);


HDescription:
Use this property to limit the length of a search.  If set to zero, the time is not checked.  For positive values, once TimeLimit is exceeded, the default behavior is for the search to abort.  This behavior may be customized by using the OnTimeout event. 

Generally, searches execute quickly unless they involve a large number of proximity searches, contain vague wildcard searches (e.g. 'a*'), or use SubFieldNames.  TimeLimit is checked during these processes.

Ranking may also be time consuming, but since ranking may be performed after the search itself is completed, TimeLimit is not checked.  Use OnRankWord instead.

Default is zero.


HDescription:
Number of words that match the search criteria of the most recent search.  For instance, the search for 'Win*' may return win95, window, windows, winner, winnt, and wins, so WordCount would be six.  Unlike MatchingWordCount, WordCount is not cumulative over successive searches.

Run-time and read only.

HExample:
if rbSearch1.WordCount >= 20 then
 MessageDlg('Please narrow search further',mtInformation,[mbOk],0);


HDeclaration:
TrbModeSearch
TrbBasicSearch
TrbReadEngine
TrbEngine
TrbBase

HDescription:
This class adds the SearchMode capability.

Do not create instances of TrbModeSearch.  Use TrbModeSearch as a base class when declaring search objects.  Properties and methods of TrbModeSearch provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure PrepareBits;
 procedure Search(S : String); override;.


HDescription:
There are three search modes: smSearch, smNarrow, smWiden.  smSearch conducts a new search when Execute is called.  smNarrow ANDs the contents of the current search with the previous search when Execute is called.  smWiden ORs the contents of the current search with the previous search when Execute is called.

HExample:
with rbSearch1 do
 begin
  SearchLogic := slAnd;
  SearchFor   := 'Inprise';
  SearchMode  := smSearch;
  Execute;
  SearchFor   := 'Borland';
  SearchMode  := smNarrow;
  Execute
 end;


HDeclaration:
TrbWildSearch
TrbModeSearch
TrbBasicSearch
TrbReadEngine
TrbEngine
TrbBase

HDescription:
This class adds wildcard searching capability.

Do not create instances of TrbWildSearch.  Use TrbWildSearch as a base class when declaring search objects.  Properties and methods of TrbWildSearch provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
The wildcard that matches any series of characters.  Must be different from OneChar. 

Default is '*'.


HDescription:
When False, searches with words that contain accented characters must match exactly with the contents of the Text.  When True, the characters in the words are normalized.  Normalization results in the words "résumé" and "resume" being viewed as equivalent.  To see how normalization works, see the Normalize procedure in rbUtils.pas.

Default is False.


HDescription:
The wildcard that matches any single character.  Must be different from AnyChar.

Default is '?'.


HDeclaration:
procedure ScanWord(var Pattern : String);


HDeclaration:
TrbProximitySearch
TrbWildSearch
TrbModeSearch
TrbBasicSearch
TrbReadEngine
TrbEngine
TrbBase

HDescription:
This class adds the proximity search capability.  Proximity searches include phrase and near searches.

Do not create instances of TrbProximitySearch.  Use TrbProximitySearch as a base class when declaring search objects.  Properties and methods of TrbProximitySearch provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
The parameter used by slNear SearchLogic to determine whether two words are near each other.  

Default is 8.

HExample:
with rbSearch1 do
 begin
  NearWord := 10;
  SearchLogic := slNear;
  SearchMode := smSearch;
  SearchFor := 'delphi component';
  Execute
 end;


HDeclaration:
function ResetScore(Container : TStContainer;
		    Node      : TStNode;
		    OtherData : Pointer) : Boolean;


HDeclaration:
TrbLogicSearch
TrbProximitySearch
TrbWildSearch
TrbModeSearch
TrbBasicSearch
TrbReadEngine
TrbEngine
TrbBase

HDescription:
This class implements the advanced SearchLogic capabilities of slExpression and slSmart.

Do not create instances of TrbLogicSearch.  Use TrbLogicSearch as a base class when declaring search objects.  Properties and methods of TrbLogicSearch provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
When SearchLogic is slExpression and there is an error in the syntax, ErrorPos returns the approximate position of the error in SearchFor.  If there is no error, ErrorPos is 0.

Run-time and read only.

HExample:
if rbSearch1.ErrorPos > 0 then { do something } ;


HDescription:
This property may be used to replace the standard slExpression tokens of And, Or, Not, Like, and Near.  The TStringList assigned to Tokens must have a Count of 5 containing the replacement strings in the same order as listed above.

The Tokens property may be used to eliminate a type of processing.  For instance, to remove Like processing, assign a blank string to Tokens[3] or Tokens[tknLike].

Since the expression processor assumes that these tokens will be preceded and followed by a space, it is best to use tokens that consist only of letters.  For instance, if a plus sign (+) were used for And, the expression processor would not correctly parse "referential+integrity" whereas it would correctly parse "referential + integrity".


HDeclaration:
TrbNavSearch
TrbLogicSearch
TrbProximitySearch
TrbWildSearch
TrbModeSearch
TrbBasicSearch
TrbReadEngine
TrbEngine
TrbBase

HDescription:
This class implements the navigation capabilities of the FindFirst, FindLast, FindNext, FindPrior, and Matches methods.

Do not create instances of TrbNavSearch.  Use TrbNavSearch as a base class when declaring search objects.  Properties and methods of TrbNavSearch provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
A set of routines that may be called after a search has been conducted to move the cursor in the TextLink to the first, last, next, or prior record that matched the search criteria.

When RankMode is rmNone, first, last, next, and prior are all relative to the IndexFieldName used to make the Words table.  Thus the IndexFieldName is the primary index, but the table is open on a secondary index, calls to FindNext will find the next record in primary index order, but this may not be the 'next' record in the secondary index.

For TrbSearch and when RankMode is rmCount or rmPercent, first moves to the highest ranking record, next moves to the next record in rank order, etc.

HExample:
with rbSearch1 do
 if FindFirst then
  repeat
   { process matching records }
  until not FindNext;


HDeclaration:
function FindPrim(Action : TFindType) : Boolean;


HDescription:
Returns True if the current record of the TextLink matches the search criteria, otherwise returns False.

HExample:
procedure TForm1.Table1FilterRecord(DataSet: TDataSet;
                                    var Accept: Boolean);
begin
 Accept := rbSearch1.Matches
end;


HDeclaration:
TrbRankSearch
TrbNavSearch
TrbLogicSearch
TrbProximitySearch
TrbWildSearch
TrbModeSearch
TrbBasicSearch
TrbReadEngine
TrbEngine
TrbBase

HDescription:
This class implements the ranking capabilities of the search component.

Do not create instances of TrbRankSearch.  Use TrbRankSearch as a base class when declaring search objects.  Properties and methods of TrbRankSearch provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
This event may be used to give certain words greater rank.  For instance, words in the Title field may be ranked higher than those in the Description field.  The event may also be used to abort the ranking process if it is taking too long.


HDescription:
RankArray is a pointer to a TRankArray which contains rank and location information regarding the matching records.  If MatchCount is zero, RankArray is nil, otherwise it points to an array of 0..Min(MatchCount-1,RankLimit) elements of TRankRecord. 

The array is not populated until it the first time it is called after a search.  Since calculating the ranking can be time consuming, you may wish to explicitly call this property and display an hourglass cursor.

The values of the Count and Percent correspond the rmCount and rmPercent RankModes unless RankMode is rmPresense, in which case the Count field corresponds to rmPresense and Percent is simply the Count field converted to a 100 scale.

Run-time and read only.

HExample:
with rbSearch1 do
 if FindNext and (RankArray <> nil) then
  RankLabel.Caption := IntToStr(RankArray^[RankIndex].Count);


HDescription:
RankArraySize is the size of the RankArray in bytes.

Run-time and read only.

HExample:
with rbSearch1 do
 if RankArray <> nil then
  begin
   GetMem(P, RankArraySize);
   Move(RankArray^, P^, RankArraySize)
  end;


HDescription:
Returns the number of matching words in the current record.  If the current record does not meet the search criteria, returns zero.

Run-time and read only.

HExample:
procedure TForm1.Table1DataChange(Sender: TObject; Field: TField);
begin
 with rbSearch1 do
  Panel1.Caption := Format('RankCount = %d, RankPercent = %d ',
                           [RankCount,RankPercent])
end;


HDescription:
When using FindXxxx methods, this property can be used to retrieve the current record's rank score.  If no FindXxxx routines have been called, returns -1.

Run-time and read only.

HExample:
with rbSearch1 do
 if FindNext and (RankArray <> nil) and (RankIndex <> -1) then
  RankLabel.Caption := IntToStr(RankArray^[RankIndex].Percent);


HDescription:
This property sets the upper limit to the number of matching items that will be ranked.  If the RankLimit is less than the MatchCount, then only the first RankLimit records in index order are ranked.  There may be higher ranking records in those records left unranked.

Default is 8000.


HDescription:
Determines how records are ordered in TrbMatchMaker and the FindXxxx methods.  

There are four RankModes: rmNone, rmCount, rmPercent, and rmPresense.  rmNone leaves the records in index or natural order as determined by the IndexFieldName used to make the TextLink.  Since the TextLink may be open on another index, the ordering of records may not be consistent with other views of the table.  

rmCount orders the records by a count of the matching words.  rmPercent is like rmCount, except results are normalized to a 100 scale.  

rmPresense orders the records by counting whether or not a matching word appears in the record.  Each matching word has a maximum score or rank of one.  If the search is for "delphi or paradox or dbase" and all three words appear in the text, the rank will be three (even if a word appears multiple times), if only two words appear, the rank will be two, etc.  Note that this property is only useful when the search uses OR search logic, otherwise all the scores will be the same.  Switching between rmPresense and any other RankMode forces the RankArray to be recalculated when next accessed, and thus can be time consuming.  When RankMode is rmPresense, the RankArray Count field is rmPresense.

Ranking, if any, occurs when RankArray is first accessed, usually by FindXxxx or when TrbMatchMaker is executed.

For searches using slNear or slPhrase SearchLogic, the ranking process only scores the matching words in the record, not whether the words are near or in sequence of each other.

Default is rmNone.


HDescription:
Returns the number of matching words in the current record using a 100 scale. If the current record does not meet the search criteria, returns zero (except as noted below).  This property requires that rankings of all matching records be computed, so it can be time consuming.  If the RankMode is rmPresense, then the number of matching words corresponds to the rmPresense RankMode.

A RankPercent of zero does not necessarily mean that the current record does not match the search criteria.  If the current record has a RankCount of 1, and another matching record has a RankCount of 101, the RankPercent of the current record will be zero (1/101 rounds to zero when div is used).

Run-time and read only.

HExample:
procedure TForm1.Table1DataChange(Sender: TObject; Field: TField);
begin
 with rbSearch1 do
  Panel1.Caption := Format('RankCount = %d, RankPercent = %d',
                           [RankCount, RankPercent])
end;


HDescription:
Number of milliseconds to took to perform the ranking.  

While the ranking is being performed, the value of RankTime is the value of GetTickCount at the beginning of the ranking process.  This value may be used in the OnRankWord event to test how long the ranking process is taking.

HExample:
RankTimeLabel.Caption := Format('1.1f Seconds',
                                [rbSearch1.RankTime / 1000.0]);

function TForm1.rbSearch1RankWord(Sender: TObject;
  const Word: String): Integer;
begin
 with Sender as TrbSearch do
  if GetTickCount - RankTime > 5000 then Abort
end;


HDeclaration:
TrbSearch
TrbRankSearch
TrbNavSearch
TrbLogicSearch
TrbProximitySearch
TrbWildSearch
TrbModeSearch
TrbBasicSearch
TrbReadEngine
TrbEngine
TrbBase

HDescription:
Use the TrbSearch component in conjunction with the WordsLink to search the TextLink.  Set the SearchFor property with the string to search for.  Whether a search is a new search or narrowing or widening a previous search is controlled by the SearchMode property.  The SearchLogic property specifies the type of logic used: slAnd, slOr, slNot, slNear, slLike, slPhrase, slExpression, and slSmart logic.  The search is performed by calling the Execute method.

The MatchCount and MatchingWordCount properties provide a numerical indicator on the success of the search.  MatchCount reports how many records met the search criteria, while MatchingWordCount reports how many unique words were located in the WordsLink.

Wildcards may be used and are defined by the AnyChar and OneChar properties.  When using wildcards, it is often useful to see the words that actually matched the search pattern.  To generate this list, use the MatchingWords method (this method may also be used when wildcards are not used).

The FindFirst, FindNext, FindPrior, FindLast, and Matches method can be used to locate matching records in the TextLink.  The order in which the FindXxxx routines navigate the TextLink is controlled by the RankMode property.

There is no need for TrbSearch to be paired with TrbMake in the same application.  TrbMake may be used in a 32 bit application to build a Words table that is read by a TrbSearch in a 16 bit applications, and visa versa.

The WordsLink does not contain any information regarding which field(s) a word originated from, only that a word is associated with a record.  This is usually not a problem unless you want to search a subset of the fields that are already part of the WordsLink.  To do this, use the SubFieldNames property.

TrbSearch ignores searches on words that have a length less than MinWordLen (unless it includes an AnyChar wildcard) or are in the OmitList.  

Unlike TrbMake, TrbSearch is not memory intensive.  In fact, because of its architecture and compression options, it makes relatively small demand on resources (CPU and network) at the time the search is conducted.

You may elect to cache search results so searches for the same word do not result in any disk or network activity.  Simply set the Cache.MemoryLimit property to the amount of memory you wish to devote to caching.  If the WordsLink is being updated while searches are being conducted, then search caching should not be enabled.

Searches against the dictionary may not be performed during a build.  If searches and updates are being performed simultaneously and caching is being used, call FlushCache for both TrbUpdate (if DelayedWrites is True) and TrbSearch before performing a search.


HDescription:
The TrbHints component is a TCustomGrid descendent that displays words that match or nearly match the words the user has entered into an edit control.  The words displayed may be updated as the user types, thus giving the user real time feedback.

The control inherits all the defaults from its ancestor control with the exception of FixedCols and FixedRows where the default is changed to zero.  To change the appearance of the control to look more 'hint-like', change the Font to 'MS Sans Serif' point size 8, Color to clYellow, GridLineWidth to zero, DefaultRowHeight to 15, and AutoSize to True.

The AutoSize property will automatically resize the control as the number of words displayed or the width of the columns change.  Use the MaxWidth property to limit the automatic resizing to the width specified.

The HintsAbove property controls how many words appear above the closest matching word.  The number of words listed in each column is the difference between RowCount and FixedRows.  When ShowWords is True, FixedCols is set to 1 and the word being looked up is displayed as a column heading.

Searcher is the TrbSearch that is being searched.  TrbHints uses the SearchFor property to determine what words to process.  TrbHints only works when the SearchLogic is slAnd, slOr, slNot, slPhrase, or slNear.

The ShowHints method makes sure the control is visible and then update the contents.

One way of using the control is to set its Visible property to False and position it under the edit control (typically a TEdit or TComboBox) and place the ShowHints method in the edit control's OnChange event.  When the application is run, the control is not visible until the user enters the edit control and starts typing (if this creates too much of a delay as the user types, use a timer to call ShowHints after a certain amount of idle time).  When the user exits the edit control, the application resets the Visible property to False (you may want to check which control is getting the focus to make sure it is appropriate to hide TrbHints).  You may also wish to set the Enabled property to False so the use cannot move the focus to this control.


HDescription:
When AutoSize is True, the control will automatically resize itself as the number of words displayed or column widths change.  Use the MaxWidth property to limit the resizing to a maximum width.

Default is False.


HDeclaration:
procedure DrawCell(ACol, ARow: LongInt; ARect: TRect;
                     AState: TGridDrawState); override;


HDeclaration:
procedure HintLists(NoLT, NoGE : Integer; List : THintLists);


HDescription:
The HintsAbove property controls how many word are listed above the closest matching word.

Default is 2.


HDescription:
Words being highlighted are relative to this TrbSearch component.


HDeclaration:
procedure RTFtoList(Filename : String; List : TStrings);


HDeclaration:
procedure Notification(AComponent : TComponent ;
			  Operation : TOperation); override;


HDeclaration:
TrbWordsBDELink
TrbCustomWordsBDELink
TrbCustomWordsTableLink
TrbWordsBaseTableLink
TrbWordsDataSetLink
TrbWordsLink
TrbBase


HDeclaration:
TrbMakeWordsBDELink
TrbCustomWordsBDELink
TrbCustomWordsTableLink
TrbWordsBaseTableLink
TrbWordsDataSetLink
TrbWordsLink
TrbBase

HDescription:
This is TrbWordsDataSetLink derived component that acts as the link or driver for TrbMake to store words in a database table via a TTable component.  TrbMakeWordsBDELink can access fields via direct calls to the BDE.  It also creates a more efficient index on the Like field when Paradox tables are used.  When this component is used to make the Words table, TrbWordsBDELink must be used to access the table.


HDeclaration:
TrbCustomTextBDELink
TrbCustomTextTableLink
TrbTextBaseTableLink
TrbTextDataSetLink
TrbTextLink
TrbBase

HDescription:
This class implements a specialized version of TrbCustomTextTableLink, but does not publish any properties.  Link classes provide the basic interface between a core Rubicon component (e.g. TrbMake, TrbSearch) and the storage class, in this case a database table accessed via a TTable component.  

TrbCustomTextBDELink can access string and memo fields via direct calls to the BDE.  It is also aware of dBase record numbers and Paradox sequence numbers which may be used instead of the IndexFieldName property to track the locations of words.

Do not create instances of TrbCustomTextBDELink.  Use TrbCustomTextBDELink as a base class when declaring table objects.  Properties and methods of TrbCustomTextBDELink provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Setting this property to True enables direct DBI calls that may improve read performance.

Default is False.


HDeclaration:
TrbTextBDELink
TrbCustomTextBDELink
TrbCustomTextTableLink
TrbTextBaseTableLink
TrbTextDataSetLink
TrbTextLink
TrbBase


HDeclaration:
TrbMakeTextBDELink
TrbCustomTextBDELink
TrbCustomTextTableLink
TrbTextBaseTableLink
TrbTextDataSetLink
TrbTextLink
TrbBase

HDescription:
This is a TrbTextDataSetLink derived component that acts as the link or driver for TrbMake to access in a database table via a TTable component.

TrbMakeTextBDELink can access string and memo fields via direct calls to the BDE.  It is also aware of dBase record numbers and Paradox sequence numbers which may be used instead of the IndexFieldName property to track the locations of words.  To use dBase record number or Paradox sequence numbers, leave the IndexFieldName property blank.  When using record or sequence numbers, TrbTextBDELink must be used for updating and searching.


HDescription:
When AutoSize is True, the maximum width of the control can be limited by using the MaxWidth property.  A zero value disables any maximum width restrictions.

Default is 0.


HDescription:
The hints displayed by TrbHints are relative to this TrbSearch.


HDescription:
The ShowHints method checks to make sure the control is visible and then updates its contents.

HExample:
procedure TForm1.Edit1OnChange(Sender: TObject);
begin
 with rbSearch1 do
  begin
   SearchFor := Edit1.Text;
   rbHints1.ShowHints;
   Execute;  
   Label1.Caption := IntToStr(MatchCount) + ' matching records'
  end 
end;


HDescription:
When ShowWords is True, FixedCols is set to 1 (if currently zero) and the word(s) being looked up is displayed as a column heading.

Default is False.


HDeclaration:
property RefreshInterval : LongInt;
					 write FRefreshInterval default 500;


HDeclaration:
procedure StateChange(Sender : TObject; NewState : TEngineStates);


HDescription:
TrbProgressDialog is a drop in form which will automatically configure itself to display the progress of a TrbMake or TrbAppend.  Double or right click at run time on the form to set or hide build statistics.  Please note that AfterProcess and AfterPost event properties of the TrbMake/TrbAppend TextLink/WordsLink it attaches to will appear blank inside the Object Inspector, but these properties are actually set.

Properties include AutoClose (close automatically when done), Engine (source TrbMake or TrbAppend), Expanded (shows more statistics), Form (pointer to the form, run-time), and RefreshInterval (how often to update).


HDescription:
When True, the progress form will automatically close upon completion of the dictionary build.  If False, it will remain open until the user closes the form.

Default is True.


HDescription:
The Engine is the TrbMake or TrbAppend whose progress is displayed in the form.


HDescription:
Determines whether the form is opened with an expanded view.

Default is False.


HDescription:
Use this property to access the form.

Run-time.

HExample:
with rbProgressDialog1 do
 if (Form <> nil) and 
    (Form.WindowState = wsMinimized) then
  Form.WindowState := wsNormal;


HDeclaration:
procedure OnFormClose(Sender : TObject ; var Action : TCloseAction);


HDescription:
Use this event to customize the appearance and/or placement of the form.

HExample:
procedure TForm1.rbProgressDialog1FormCreate(Sender: TObject);
begin
 with rbProgressDialog1.Form do
  begin
   Caption := 'Segments 0 & 1';
   Show;
   Left := Left - Width div 2 - 16
  end
end;


HDescription:
The data displayed on the form is updated every RefreshInterval milliseconds.  Setting RefreshInterval to zero results in the data being updated every time the TrbMake or TrbAppend processes a record.

Default is 500 (0.5 seconds).


HDescription:
The TrbTable component is a descendent of TTable that has the TrbUpdate AfterDelete, AfterPost, BeforeDelete, BeforeEdit, and BeforeInsert methods build in.  TrbUpdate checks to see if its TextLink is connected to a TrbTable, and if so, will automatically connect the appropriate methods.


HDescription:
This event is fired after an update is performed.

HExample:
procedure TForm1.rbTable1AfterUpdate(Sender: TObject);
begin
 Inc(UpdateCounter)
end;


HDescription:
The TrbBaseUpdate component associated with the table.


HDescription:
Each time the table is edited, Rubicon examines the fields being indexed before and after the edit to determine what changed.  If the only fields being edited consist of not included in the Rubicon indexing, then this processing may be disabled by setting UpdatesEnabled to False.

Default is True.

HExample:
with rbTable1 do
 begin
  UpdatesEnabled := False;
  Edit;
  FieldByName('Price').AsFloat := 4.95;
  Post;
  UpdatesEnabled := True
 end;


HDescription:
Use this class to create a DataSet containing the records matching the search criteria.  Records are added to the DataSet in RankMode order.

If the RankMode is not rmNone, then a rank field will be added as the rightmost column.  The name of the column is RankFieldName.


HDescription:
The TDataSet tol be populated with matching records.  The DatabaseName and TableName of the DataSet must be set.


HDescription:
Call this procedure after a search to fill the DataSet with records from the TextLink matching the search criteria.  The number of records copied into DataSet is the lesser of MatchCount or MatchLimit.  If a DataSet already exists, it is overwritten.  FieldNames controls which fields are included in the DataSet.  The fields in the DataSet retain the same property values for Alignment, DataType (ftAutoInc is translated to ftInteger), DisplayLabel, DisplayWidth, ReadOnly, and Visible as their counterparts in the TextLink.  RankMode controls the order of the records in the DataSet.

If MatchCount is greater than MatchLimit, then matching records up to MatchLimit are added to the DataSet.

HExample:
rbSearch1.Execute;
if rbSearch1.MatchCount > 0 then
 rbMatchMaker1.Execute;


HDescription:
Use this property to control which fields are included in the DataSet.  If the list is empty, all fields are included.

Default is an empty list.

HExample:
with rbMatchMaker1.FieldNames do
 begin
  Clear;
  Add('CustNo');
  Add('Customer')
 end;


HDescription:
Use this property to limit the number of records copied to the DataSet.

Default is 25.


HDescription:
The amount of time in milliseconds that the creation and population of the DataSet took.  While the DataSet is being populated, MatchTime is the value of GetTickCount at the beginning of the process.

Run-time and read only.

HExample:
with rbMatchMaker1 do
 begin
  Execute;
  MatchTimeLabel.Caption := Format('1.1f Seconds',[MatchTime / 1000.0])
 end;


HDescription:
If a rank field is included in the DataSet, the column is given this name.

Default is 'Rank'.


HDescription:
Matching records are selected from this TrbSearch component.


HDescription:
Limits the time spent creating and populating the DataSet.  Value in milliseconds.  If zero, then the TimeLimit is disabled.

Default is zero.


HDescription:
Set this property to a positive value to enable transactions while adding matching records to the DataSet.  When used with SQL tables, enabling transactions can reduce index build and update times by as much as 85%.  The component uses the TransIsolation mode of the DataSet's Database.

The correct value for Transactions will vary primarily on the server type and available memory.  Higher values improve performance.

Default is 0.


HDeclaration:
procedure AddScoreField(DataSet : TDataSet; const FieldName : String);


HDeclaration:
procedure CheckMatchResults(Search : TrbSearch; DataSet : TDataSet; Sorted : Boolean);

HDescription:
Use this procedure to perform a union of the Rubicon search results and the DataSet.  After calling the procedure, Search will reflect the results of the union.  The DataSet is not altered.  The DataSet must contain the IndexFieldName column.  If the DataSet is sorted by IndexFieldName, then Sorted may be set to True.  However, if Search.MatchCount is small and DataSet.Record.Count is large, setting Sorted to False should improve performance.  The Sorted parameter is ignored under Delphi 1.  The DataSet must be indexed for Delphi 1.

HExample:
procedure TForm1.Button1Click(Sender: TObject);
begin
 with rbSearch1 do
  begin
   SearchFor := Edit1.Text;
   Execute;
   CheckMatchResults(rbSearch1,Table1,False);
   Label1.Caption := Format('%d matching records',[MatchCount]);
   if MatchCount > 0 then
    rbMatchMaker1.Execute
  end
end;


HDescription:
Use the TrbController component to perform a search on multiple database tables.  Rather than performing the search itself, the component coordinates or controls all the TrbSearch components that have the same Owner as TrbController.  

In the Execute method, the TrbController iterates through the components in the form or data module, and identifies and calls Execute for each TrbSearch.  Each TrbSearch must be setup just as if it were a standalone search - it must have a TextLink and a WordsLink associated with it.

Use the Conformity property to selectively apply the properties of the MasterSearcher to all the search components on the form.  By default, all the properties of the MasterSearcher are applied to all the other search components, but this may not always be appropriate.  If a property is not applied from the MasterSearcher, then each search control retains its existing state for that property.  For instance, if the size of the tables being searched varies, then you may elect not to make each search component's Cache.MemoryLimit comply with the MasterSearcher.  

Before executing the search, set the SearchFor, SearchLogic, SearchMode, etc., for the MasterSearcher, then call Execute.  You may now use MatchCount, MatchingWordCount, FindFirst, FindLast, FindNext, FindPrior, and MatchingWords just like you would with a single TrbSearch.

Since the FindXxxx routines will navigate through TextLinks, you will need to identify which TextLink the method is currently referencing.  This may be done using the Searcher property.  It is the current search component, and the FindXxxx routine will be referencing a record in Searcher.TextLink.

TrbController can use a TrbMatchMaker to produce a match dataset.  Instead of calling TrbMatchMaker.Execute, call TrbController.CreateMatchDataSet.  If the FieldNames are the same for all the search components and these fields are the same type and size across the tables, then CreateMatchDataSet will produce a match table just like a stand alone TrbMatchMaker would.  If this criteria is not met, then the table consists of a memo field in which are stored the DisplayLabel and DisplayText for the fields being indexed in the matching record.

Since the table created by CreateMatchDataSet will consist of records form multiple tables, TrbController will by default include additional fields containing that database name, table name, and location of the matching record.  Whether these fields are included and their field names may be controlled with the FieldNames property.


HDeclaration:
procedure AddField(DataSet : TDataSet; Index : Integer; FieldType : TFieldType);


HDescription:
This property controls to what extent the properties of the MasterSearcher are applied to the other search components in the form or data module. 

Default is [cnAnyChar..cnTokens].

HExample:
with rbController1 do 
 Conformity := DefaultConformity -[cnMemoryLimit];


HDeclaration:
constructor Create(AOwner : TComponent) ;


HDescription:
Call this procedure after a search to create a dataset containing the matching records.  CreateMatchDataSet requires that MatchMaker property be set.  Most of the work is done by the MatchMaker, but CreateMatchDataSet calls MatchMaker in a way that allows records from multiple table to be added to the match dataset.  The properties of MatchMaker should be set as they would be for a stand alone search (e.g. DataSet, RecordLimit)

As with TrbMatchMaker, if a DataSet already exists, it is overwritten.  MatchTableFieldNames controls which fields are included in the DataSet.  The fields in the DataSet retain the same property values for Alignment, DataType (ftAutoInc is translated to ftInteger) , DisplayLabel, DisplayWidth, ReadOnly, and Visible as their counterparts in the TextLink if all the tables are identical.  RankMode of the MasterSearcher controls the order of the records in the DataSet.

HExample:
with rbController1 do
 begin
  Execute;
  if MatchCount > 0 then
   CreateMatchDataSet
 end


HDeclaration:
procedure DoMergeField(Field : TField; List : TStrings);


HDescription:
Performs a search based on the values of the Conformity and MasterSearcher.

HExample:
with rbController1.MasterSearcher do
 begin
  SearchFor := 'Borland';
  SearchLogic := slAnd;
  SearchMode := smSearch
 end;
rbController1.Execute;


HDescription:
Because records added to the match table come from different tables, TrbController adds up to three extra fields to identify where they came from.  The default names for these fields are DBName, Location, and TableName.  The default size for the DBName and TableName fields is 20 characters.  This property controls the names and sizes of these fields. 

If the tables being searched have different record structures (i.e different field names, data types, or sizes), then records cannot be added to the match table using their existing field structure.  Instead, TrbController takes the field values (DisplayLabel and DisplayText) and places them in a memo field, Contents.

FieldNames property should only be changed from the IDE.  Setting a field name to blank removes the field from the table.

HExample:
procedure DefaultFieldNames(List: TStrings);
begin
 with List do
  begin
   Clear;
   Add('Contents');   
   Add('DBName;20');
   Add('Location');
   Add('TableName;20')
  end
end;


HDescription:
A set of routines that may be called after a search has been conducted to move the cursor in the TextLink.DataSet to the first, last, next, or prior record that matched the search criteria.

HExample:
with rbController1 do
 if FindFirst then
  repeat
    { do something }
  until not FindNext;


HDescription:
The properties in the MasterSearcher are applied to all the search components controlled by TrbController before the search is executed.  Use the Conformity property to control which properties are set uniformly across the search components.  If the property is not set, the properties of the search components are not altered.


HDescription:
Number of records matching the search criteria.

HExample:
with rbController1 do
 begin
  Execute;
  if MatchCount < 100 then 
   CreateMatchDataSet
 end


HDescription:
Number of words that match the search criteria.  For instance, the search for 'Win*' may return win95, window, windows, winner, winnt, and wins, so MatchingWordCount would be six.  A list populated by MatchingWords will return MatchingWordCount words.

MatchingWordCount is cumulative over successive searches if the MasterSearcher.SearchMode is not smSearch.  If a smNarrow search is executed after a smSearch search, and the MatchingWordCount increases, then new words were found.

Run-time and read only.


HDescription:
Returns a list of words matched during the search.  If only slAnd, slNear, and slPhrase SearchLogic are used, then all the words in the list will be in each matching record.  If other types of SearchLogic are used, then only a subset of words in the list will be in each matching record (e.g. words matched using slNot will never appear in the matching records).

HExample:
with rbController1.MasterSearcher do
 begin
  SearchLogic := slAnd;
  SearchFor := 'Win*'
 end;
with rbController1 do
 begin
  Execute;
  MatchingWords(ListBox1.Items);  { Returns Win95, Windows, WinNT }
 end;


HDeclaration:
procedure MergeFieldToList(Field : TField; List : TStrings);

HDescription:
This method may be used inside an OnMergeField event handler to perform the default handling of merging the Field into the List.


HDeclaration:
procedure Notification(AComponent : TComponent; Operation : TOperation);


HDescription:
Use this event to control which search components in the form or data module are included in the search.

HExample:
function TForm1.rbController1AcceptSearch(Sender: TObject; 
                  Searcher: TrbSearch) : Boolean;
begin
 Result := Searcher.Tag = 0
end;


HDescription:
Use this event to control how a field is added to the memo field during a multi table search.  This event is called from CreateMatchDataSet only when the fields being added to the match table are not identical.

HExample:
procedure TForm1.rbController1MergeField(Sender: TObject;
  Field: TField; List: TStrings);
begin
 with Field do
  if Field.DataType <> ftMemo then
    List.Add(Uppercase(DisplayLabel) + '::' + DisplayText)
  else
   TrbController(Sender).MergeFieldToList(Field,List)
end;


HDescription:
Use this property to access the current search engine.  This is useful when using the FindXxxx routines as this property indicates which search engine the FindXxxx routine has moved to.

Run-time and read only.

HExample:
with rbController1 do
 if FindFirst then
  repeat
   ListBox1.Items.Add(TrbTextDataSetLink(Searcher.TextLink).DataSet.Fields[0].AsString)
  until not FindNext;


HDeclaration:
function JustFieldName(const S : String) : String;


HDeclaration:
function JustFieldSize(const S : String) : Integer;


HDescription:
Implements the minimum properties required for this class, Accept and Word.

Do not create instances of TrbBaseAccept.  Use TrbBaseAccept as a base class when declaring accept objects.  Properties and methods of TrbBaseAccept provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
This property is set after a word has been assigned to the Word property.  It should be considered as a read only property, but is published so that its value is displayed in the Property Editor, and thus allows for interactive testing of other properties.

HExample:
function TForm1.rbMake1AcceptWord(Sender: TObject; 
                                  const Word: String) : Boolean;
begin
 rbAccept1.Word := Word;
 Result := rbAccept1.Accept
end;


HDescription:
Performs analysis on the Word, but does not include any logic to accept or reject the Word.

Do not create instances of TrbAnalyzeWord.  Use TrbAnalyzeWord as a base class when declaring accept objects.  Properties and methods of TrbAnalyzeWord provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Indicates which characters are alpha (as opposed to numeric).  Words being analyzed are assumed to be uppercase, so there is usually no need to include lowercase characters in this property.  Vowels are included.  When used with words containing international characters, the appropriate accented characters should be added.

Characters that are neither Alpha nor Numeric are assumed to be other characters (e.g. punctuation).

Default is A..Z.

HExample:
with rbAccept1 do
 Alpha := Alpha + 'ÇÑ';


HDescription:
Returns the number of Alpha characters in the Word.  The value includes vowels.

HExample:
function TForm1.rbMake1AcceptWord(Sender: TObject; 
                                  const Word: String) : Boolean;
begin
 rbAccept1.Word := Word;
 with rbAccept1 do
  Result := AlphaCount > NumericCount 
end;

HSee_Also:
Alpha, ConsecutiveCount, NumericCount, OtherCount, VowelCount


HDescription:
The maximum number of consecutive characters appearing in the Word.

HExample:
function TForm1.rbMake1AcceptWord(Sender: TObject; 
                                  const Word: String) : Boolean;
begin
 rbAccept1.Word := Word;
 Result := rbAccept1.ConsecutiveCount < 6
end;


HDeclaration:
function GetString(Index : Integer) : String;


HDescription:
Indicates which characters are numeric (as opposed to alpha).

Characters that are neither Alpha nor Numeric are assumed to be other characters (e.g. punctuation).

Default is 0..9.


HDescription:
The number of Numeric characters that appear in the Word.

HExample:
function TForm1.rbMake1AcceptWord(Sender: TObject;
                                  const Word: String) : Boolean;
begin
 rbAccept1.Word := Word;
 Result := rbAccept1.NumericCount < 3
end;

HSee_Also:
AlphaCount, ConsecutiveCount, Numeric, OtherCount, VowelCount


HDescription:
The number of characters that are neither Alpha nor Numeric that appear in the Word.

HExample:
function TForm1.rbMake1AcceptWord(Sender: TObject; 
                                  const Word: String) : Boolean;
begin
 rbAccept1.Word := Word;
 Result := rbAccept1.OtherCount = 0
end;


HDeclaration:
procedure SetString(Index : Integer; Value : String);


HDescription:
Characters considered vowels.  Note that Vowel is a subset of Alpha.  Since words being tested are usually uppercase, there is generally no reason to include lowercase characters.  When used with words containing international characters, the appropriate accented characters should be added.

Default is AEIOUY.


HDescription:
The number of Vowel characters that appear in the Word.

HExample:
function TForm1.rbMake1AcceptWord(Sender: TObject; 
                                  const Word: String) : Boolean;
begin
 rbAccept1.Word := Word;
 Result := rbAccept1.VowelCount >= 1
end;

HSee_Also:
AlphaCount, ConsecutiveCount, NumericCount, OtherCount, Vowel


HDescription:
Implements logic to accept or reject a Word.

Do not create instances of TrbCustomAccept.  Use TrbCustomAccept as a base class when declaring accept objects.  Properties and methods of rbCustomAccept provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
property Balance : Integer;
           read FBalance
           write SetInteger
           default DefaultBalance;

HDescription:
Words are accepted if the AlphaCount minus the NumericCount is greater than or equal to Balance.  A zero Balance means that an equal number or more Alpha characters must appear in the word than Numeric characters.  To disable this test, just set Balance to a large negative number.

Default is Zero.


HDeclaration:
property ConsecutiveLimit : Integer;
           read FConsecutiveLimit
           write SetInteger
           default DefaultConsecutiveLimit;

HDescription:
A character appearing more than ConsecutiveLimit times consecutively will be rejected.  The character may be Alpha, Numeric, or other.

Default is 4.


HDeclaration:
property MinVowelCount : Integer;
           read FMinVowelCount
           write SetInteger
           default DefaultMinVowelCount;

HDescription:
Words must contain MinVowelCount words or they are rejected.  This test is only applied if the Word contains MinVowelLength characters or more.

Default is 1.


HDeclaration:
property MinVowelLength : Integer;
           read FMinVowelLength
           write SetInteger
           default DefaultMinVowelLength;

HDescription:
Words that contain at least MinVowelLength characters and do not contain MinVowelCount vowels are rejected.

Default is 4.


HDeclaration:
property NoLeadingNumbers : Boolean
           read FNoLeadingNumbers
           write SetNoLeadingNumbers
           default True;

HDescription:
Word is rejected if the first character is numeric.

HExample:
with rbAccept1 do
 begin
  NoLeadingNumbers := True;
  Word := '1STOP'; { This word will be rejected }
  if not Accept then MessageBeep(0)  
 end;


HDeclaration:
property NumericLimit : Integer;
           read FNumericLimit
           write SetInteger
           default DefaultNumericLimit;

HDescription:
Words containing more than NumericLimit numbers are rejected.

Default is 3.


HDeclaration:
property OtherLimit : Integer;
           read FOtherLimit
           write SetInteger
           default DefaultOtherLimit;

HDescription:
Words may contain up to OtherLimit other characters (characters other than Alpha and Numeric) before they are rejected.

Default is 2.

HSee_Also:
Alpha, Balance, ConsecutiveLimit, MinVowelCount, Numeric, NumericLimit


HDescription:
Use this class to filter out extraneous words in the OnAcceptWord event.

When indexing text that contains a large number of unique words (more than 50,000), build, update, and search performance can be improved by reducing the number of words being indexed.  The simplest way to this is to check the settings of MinWordLen and WordDelims.  However, even when these properties are properly set, the number of unique words can still be large.

The next step would be to determine whether the number of unique words in the text can be reduced.  For instance, spell checking the text.  

As a last resort, certain words can simply be rejected from indexing.  TrbAccept is a class that will accept or reject works based on certain properties.  For instance, words that begin with a number can be rejected, or words where the same character appears four or more times consecutively (e.g. woooow), or words that do not contain a vowel.  

When used with TrbMake, be sure to use an identically configured TrbAccept with TrbUpdate else an error will be raised.

When using TrbAccept, you may wish to check search requests to see if they contain rejected words and, if so, alert the user that the word has been omitted from the index.  This could be done in the OnPreviewWord event.

It is recommended that before applying TrbAccept that all or part of the text be indexed with TrbMake and that TrbAccept be applied to the words to see which words are rejected and how many words are being rejected.  If fewer than 5% of the words are rejected, it may not be worth using this technique.


HDescription:
TrbRichEdit is a read only control that can display text or RTF with matching words highlighted.  The behavior of the control is very similar to a TDBMemo or TDBRichEdit, but is only available on 32 bit platforms.

The control may linked to a field in a table via the DataSource and DataField properties.  It may also be used with data stored in a text or RTF file by simply reading the file with the Lines.LoadFromFile method.

Matching words are highlighted in bold.  To override this behavior, use the OnHighlight event.

To navigate between matching words, use the FindFirst, FindLast, FindNext, and FindPrior methods.

32 bit only.


HDescription:
Use these methods to navigate from one matching word to the next.  FindNext and FindPrior move relative to the current position in the control.

HExample:
if not rbRichEdit1.FindNext then MessageBeep(0)


HDescription:
TrbRichEdit automatically calls this procedure after MatchingWords are set and when the TextLink's DataSource.DataChange event is called.  If you set the Lines property directly, you will need to call HighlightWords.  The procedure sets all words matching the list of words in MatchingWords style to fsBold.  This behavior can be customized in the OnHighlight event.

HExample:
with rbRichEdit1 do
 begin
  Lines.LoadFromFile(Edit1.Text);
  HighlightWords
 end;


HDescription:
This property contains the list of matching words that are being highlighted in the TrbRichEdit control.  The source of the matching words is the Searcher.  The property may also be explicitly set as shown in the example.


HDescription:
The default behavior of a TrbRichEdit control is to highlight each matching word by setting the style to fsBold.  The OnHighlight event may be used to override this behavior by setting the properties of SelAttributes.

HExample:
procedure TForm1.rbRichEdit1Hightlight(Sender: TObject);
begin
 with Sender as TrbRichEdit do
  SelAttributes.Color := clRed
end;


HDescription:
TrbUpdateDialog is a drop in form that will automatically configure and display itself when TrbUpdate is used.  This component is primarily designed for monitoring the update process during development.  Double or right click at run time on the form to set or hide various panels.  Open rbUpdDlg.pas in the Delphi IDE to see a description of all the properties displayed.  Displaying the Words and/or LRU panels will slow performance as these panels require calling routines that iterate through the entire cache.

Panel	Description
Cache	Displays all the major properties
Memory	Displays current and maximum memory usage, as well as the memory limit
Words	Displays the number of uncompressed, compressed, and unwritten words in the cache.  The number or uncompressed and compressed words plus the number of omit words (not displayed) make up all the words in the cache.
LRU	Least Recently Used statistics.  The highest LRU is the most recently used word, the lowest is the least recently used.  The Current LRU is the index of the most recently used word.  Words with LRUs greater than the Compress LRU are held in memory uncompressed.  If the LRU is less than or equal to Compress LRU and greater than Flush LRU, the word is held in memory and compressed.  Words with LRUs less than or equal to Flush LRU are removed from memory.

Properties include Expanded (displays three columns of data instead of two), Form (pointer to the form, run-time), Panels (which panels to display), RefreshInterval (how often to update the data), and Updater (source TrbUpdate).


HDescription:
Use this property to access the form.

Run-time and read only.

HExample:
with rbUpdateDialog1 do
 if (Form <> nil) and 
    (Form.WindowState = wsMinimized) then
  Form.WindowState := wsNormal;


HDeclaration:
procedure Notification(AComponent : TComponent ;
			    Operation : TOperation); override;


HDescription:
Determines which panels are visible.

Default is [upCache, upMemory].


HDescription:
The data displayed on the form is updated every RefreshInterval ticks.  Setting RefreshInterval to zero results in the data being updated every time the TrbUpdate processes a record.

Default is 500 (0.5 seconds).


HDescription:
Assign this method to the AfterUpdate and/or AfterBatch events in order to notify TrbUpdateDialog when to update itself.  When the first update is performed, the update dialog will be automatically displayed.

HExample:
procedure TForm1.FormCreate(Sender: TObject);
begin
 rbTable1.AfterUpdate := rbUpdateDialog1.UpdateEvent;
 rbUpdate1.AfterBatch := rbUpdateDialog1.UpdateEvent
end;


HDescription:
Determines the TrbUpdate whose statistics are being displayed.


HDeclaration:
TrbCustomWordsBDELink
TrbCustomWordsTableLink
TrbWordsBaseTableLink
TrbWordsDataSetLink
TrbWordsLink
TrbBase

HDescription:
This class implements a specialized version of TrbCustomWordsTableLink, but does not publish any properties.  Link classes provide the basic interface between a core Rubicon component (e.g. TrbMake, TrbSearch) and the storage class, in this case a database table accessed via a TTable component.

TrbCustomWordsBDELink can fields via direct calls to the BDE.  It also uses a more efficient index on the Like field when Paradox tables are used.

Do not create instances of TrbCustomWordsBDELink.  Use TrbCustomWordsTableLink as a base class when declaring table objects.  Properties and methods of TrbCustomWordsBDELink provide basic behavior that descendent classes inherit, override, and customize.


HDescription:
Setting this property enables the use of direct DBI calls during reading that may improve performance.

Default is False.


HDescription:
Setting this property enables the use of direct DBI calls during writing that may improve performance.  Do not use with table types that do not natively support 32 bit integers (e.g. dBase).

Default is False.


HDeclaration:
function GetRecordNo(DataSet : TDataSet) : LongInt;


HDeclaration:
function GetRecordSize(DataSet : TDataSet) : Word;


HDeclaration:
function GetSeqNo(DataSet : TDataSet) : LongInt;


HDeclaration:
function GetTableType(DataSet : TDataSet) : TTableType;


HDeclaration:
procedure SetToRecordNo(DataSet : TDataSet; RecordNo : LongInt);


HDeclaration:
procedure SetToSeqNo(DataSet : TDataSet; SeqNo : LongInt);


HDescription:
This class implements WordsLink methods that can be shared across all TTable-like links.  Those tasks that cannot be implemented are left to descendent classes to handle.

Do not create instances of TrbWordsBaseTableLink.  Use TrbWordsBaseTableLink as a base class when declaring word link objects.  Properties and methods of TrbWordsDataSetLink provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure HintList(S : String; NoLT, NoGE : Integer ;
                     List : TStrings); override;


HDescription:
This class implements TextLink methods that can be shared across all TTable-like links.  Those tasks that cannot be implemented are left to descendent classes to handle.

Do not create instances of TrbTextBaseTableLink.  Use TrbTextBaseTableLink as a base class when declaring text link objects.  Properties and methods of TrbTextBaseTableLink provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure RestoreIndex(const SaveIndex : TSaveIndex);


HDeclaration:
procedure SwitchIndex(var SaveIndex : TSaveIndex);


HDescription:
This class implements WordsLink methods that can be shared across all TQuery-like links.  Those tasks that cannot be implemented are left to descendent classes to handle.

Do not create instances of TrbWordsSQLLink.  Use TrbWordsSQLLink as a base class when declaring word link objects.  Properties and methods of TrbWordsSQLLink provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure qGotoWord(SQL : TStrings; Segment : Integer);


HDeclaration:
procedure qPrepareScan(SQL : TStrings; S : String; AnyChar,OneChar : Char);


HDescription:
This class implements TextLink methods that can be shared across all TQuery-like links.  Those tasks that cannot be implemented are left to descendent classes to handle.

Do not create instances of TrbTextSQLLink.  Use TrbTextSQLLink as a base class when declaring text link objects.  Properties and methods of TrbTextSQLLink provide basic behavior that descendent classes inherit, override, and customize.


HDeclaration:
procedure PrepareQuery(SQL : TStrings; TQ : TTextQueries);


HDescription:
Text queries by default only select the IndexFieldName and FieldNames fields.  If an application needs to access other fields, then set SelectAll to true and all the fields will be retrieved.

When using a TrbMatchMaker, it is often necessary to set SelectAll to True in order to include fields other than IndexFieldName and FieldNames.

Default is False.


HDeclaration:
function DoAcceptSearch(RS : TrbRankSearch) : Boolean;


HDeclaration:
procedure dbRTFtoList(Field : TField; List : TStrings);


HDescription:
Returns the number of matching words found for the current record.  If the current record does not meet the search criteria, returns zero.  Each matching word has a maximum score or rank of one.  If the search if for "delphi or paradox or dbase" and all three words appear in the text, the rank will be three (even if a word appears multiple times), if only two words appear, the rank will be two, etc.  Note that this property is only useful when the search uses OR search logic, otherwise all the scores will be the same.

Run-time and read only.


HDescription:
If the configuration of Rubicon components are changed at run time, it may be necessary to call this method before executing any subsequent operations (e.g. rbSearch1.Reset).  Should only be called by TrbEngine descendents.  It should only be necessary to call Reset when changing a link, the dataset associated with a link, or a cache component at run time.  Call Reset after making changes to properties, but before calling Execute or performing a delete/edit/insert.


HDescription:
Set this property to True in TrbMake (it is read only elsewhere) to enable faster searching for phrases.  When enabled, searches containing leading wildcards are not supported unless ReverseField is also enabled.

This property should only be set by advanced users after careful evaluation since using it increases the Words table size significantly.  This property is public, not published, so it must be set in code.


HDescription:
Use this event to implement custom parsing to the text.  S is a pointer to the text being parsed.  Len in the number of characters in S.  The function should return the next word, S should be returned pointing to a character that follows the word, and Len should returned decremented by the number of characters processed by the function. 
The event should return each word to the Sender even if the word does not meet the MinWordLen criteria, the word is in the OmitList, or the word may be rejected by the OnAcceptWord event.  Even if a word is not indexed, it can be used in proximity searches and may be used when FastPhrase is enabled.

This event is called when indexing the text and when parsing words entered in a search.  This ensures that the parsing used is consistent between indexing and searching.  However, when searches are performed, wildcard characters should not be considered as word delimiters.  Therefore, when the event is called in the context of a search, the Wildcards parameter is set to True so that the event can make the appropriate adjustments.

If this event is used to index the text in TrbMake, the OnParseWord event must also be set in TrbUpdate and TrbSearch.

In Delphi 1, the Len parameter will appear as a Word.

HExample:
{ From c:\rubicon2\examples\ttable\ExParse.dpr }
function TForm1.CustomParseWord(Sender: TObject; var S: PChar;
  var Len: Cardinal; WildCards: Boolean): String;
begin
 with TrbEngine(Sender) do
  if WildCards then
   Result := ExtractWordEx(S,Len,MaxWordLength,WordDelimsSet - ['*','?'],SoftDelims)
  else
   Result := ExtractWordEx(S,Len,MaxWordLength,WordDelimsSet,SoftDelims)
end;


HDeclaration:
property SearchOptions : TSearchOptions;
TSearchOption = (soLazyPhrase,soNavNatural,soNavReverse); 
TSearchOptions = set of TSearchOption;

HDescription:
When soNavNatural is set, navigation with FindFirst, FindNext, FindPrior, and FindLast is in natural order based on the IndexFieldName, otherwise navigation is based on the RankMode.

soNavReverse reverses the meaning of the FindXxxx methods.  When set, FindFirst acts like FindLast, FindNext acts like FindPrior, etc.  This is useful when used with TrbMatchMaker because it can reverse the ordering of the Match dataset.

When this soLazyPhrase is set and the Words table has been indexed with FastPhrase, slPhrase searches will not confirm that the phrase exists in the Text and thus result in faster search performance.  If FastPhrase has not been enabled, this property is ignored.  This setting should only be used by advanced users after careful evaluation since using it may result in false matches when the phrase consists of three or more words.

HSee_Also:
FastPhrase, FindFirst, FindLast, FindNext, FindPrior, RankMode, TrbMatchMaker


HDescription:
When a TrbCache is used with TrbUpdate or TrbSearch, words and indexes are added to the cache as they are used by the engine.  When the cache is full, the indexes will be compressed.  When more than CompressPercent of the words in the cache are compressed, then the least recently used words are purged from the cache.

Setting CompressPercent to a higher value means that more words can be held by the cache, but more time will be spent compressing and decompressing frequently used words.  This setting has no impact when the cache is used with a TrbMake or TrbAppend component.

Default is 75.  Acceptable values are 1..99.  Recommended values are in the range of 60..90.


HDeclaration:
function ConcatWords(const W1,W2 : String) : String;


HDeclaration:
procedure HandleWord(const Word : String);


HDeclaration:
function IsCapable(Value : TCapability) : Boolean;


HDescription:
When this property is True, the Words table will contain an rbReverse field which will be the reverse of the rbWord field. The rbReverse field is used to optimize the performance of searches that begin with a wildcard, but do not end with a wildcard (e.g. '*tion', but not '*pute*'). 

Default is False. 

HSee_Also:
BlobFieldSize, BytesFieldSize, CharFieldSize, LikeFieldSize, WordFieldSize


HDeclaration:
procedure GetIndexNames(List : TStrings; All : Boolean);


HDeclaration:
procedure TableIndexNames(T : TTable; List : TStrings; All : Boolean);


HDeclaration:
function IgnoreWord(const Word : String) : Boolean;


HDeclaration:
function GetStringField(FldNo : Integer) : String;


HDeclaration:
procedure SetStringField(const Value : String; FldNo : Integer);


