Access to this feature requires an active Software Asset Management (SAM) subscription. See Benefits of ‘Software Asset Management” Feature Line.

At the core, BBj uses its FULLTEXT "file type" to implement full text searching and indexing. This file type allows BBj to interface with a standard Lucene index as if it were a standard BBj data file. An application creates a FULLTEXT file using the FULLTEXT verb (or at the database level using the EM or SQL as discussed in SQL FULLTEXT Indices). The application opens, writes records to, and reads records from the FULLTEXT file using familiar BBx file operations such as OPEN, WRITE RECORD, READ RECORD, and REMOVE.

The following simple example shows how one could write comments to a FULLTEXT file for quick searching:

REM Create the FULLTEXT file

myFile$ = "/mydata/COMMENTS.text"

template$ = "ID:C(8),COMMENTS:C(32767*)"

keyField$ = "ID"

FULLTEXT myFile$, template$, keyField$


REM Open the file and write 2 records to it

chan = unt


DIM record$:template$

record.ID$ = "00000001"

record.COMMENTS$ = "I like blue shirts and yellow socks."

WRITE RECORD (chan) record$


record.ID$ = "00000002"

record.COMMENTS$ = "I like red hats and orange tigers."

WRITE RECORD (chan) record$


REM Perform a simple word search

READ RECORD (chan, KNUM=1, KEY="yellow") record$

PRINT "Match: " + record.COMMENTS$


REM This read will fail with EOF since there are no

REM additional matches

READ RECORD (chan) record$


The program breaks down as follows:

  • Creates the Lucene index using FULLTEXT verb with a specific template to define its contents.
  • Writes two records to the index using standard WRITE RECORD calls.
  • Specifies a query to be used for iteration over the file using the READ RECORD verb, KNUM= 1 to indicate a query (use KNUM=0 instead to specify the key for a specific record), and KEY="..." to specify the Lucene format query.
  • Displays the matching result.
  • Attempts to read another result which will fail with EOF if no additional matches are found.

See Also

Full Text Indexing and Searching



Using FULLTEXT Files/Indices for Searching



Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.