Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FAST TEXT SEARCH for Clipper v.2.0 - <b>indexing and filtering</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   Indexing and Filtering
 
   Application developers sometimes get into trouble with CFTS when they 
   forget that in order to produce an accurate CFTS index, the records of 
   the primary .DBF that will be searched must be passed to CftsAdd() in 
   their natural order. This means that when a CFTS index is created SET 
   DELETED should be OFF and, assuming that there are active Clipper 
   indexes, that SET ORDER TO should be 0. Likewise, there should be no 
   active filter conditions when a CFTS index is generated. Look at the 
   Cfts_Index() in CFTS87.PRG or CFTS5.PRG for an example.

   To work correctly CFTS must create an index record for each record 
   in the primary database file. CFTS does not store .DBF record 
   numbers, rather the values returned by CftsAdd() and CftsNext() are 
   derived from the position of the index record in the index file.

   Once the CFTS index is completed, an application can restore Clipper 
   indexes, turn DELETED ON, and establish FILTERS. With Clipper indexes 
   restored, records can be appended to the primary database and to the 
   CFTS index without trouble, because appended records are always added 
   to the end of the .DBF and the CFTS index file. Consequently, the CFTS 
   index order will be maintained. Once again, it is a good idea to 
   always test the values returned by CftsAdd() against the current .DBF 
   record number. A difference can indicate a problem.

   Filter conditions can be used when searching with CFTS, but developers 
   should think twice before using them in these situations since they 
   may find themselves paying a substantial performance penalty. In the 
   event that an application does make use of a FILTER when searching, 
   developers should check for EOF() after each hit, so as to avoid 
   performing verifies on empty strings.

   If a developer must use filters, a better strategy would be to search 
   without a filter and then test those records returned by CftsNext() to 
   see if the should be excluded from the search based on the condition 
   the developer would have used with the SET FILTER command. This limits 
   the number of records that must be inspected for the filter condition.


See Also: Cfts_Index()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson