Next: , Previous: WordCursor SYNOPSIS, Up: WordCursor


10.19.3 WordCursor DESCRIPTION

WordCursor is an iterator on an inverted index. It is created by asking a WordList object with the Cursor. There is no other way to create a WordCursor object. When the Walk* methods return, the WordCursor object contains the result of the search and status information that indicates if it reached the end of the list (IsAtEnd() method).

The callback function that is called each time a match is found takes the following arguments:

     WordList* words pointer to the inverted index handle.
     WordDBCursor& cursor to call Del() and delete the current match
     WordReference* wordRef is the match
     Object& data is the user data provided by the caller when
                  search began.

The WordKey object that specifies the search criterion may be used as follows (assuming word is followed by DOCID and LOCATION):

Ex1: WordKey() walk the entire list of occurences.

Ex2: WordKey("word <UNDEF> <UNDEF>") find all occurrences of word .

Ex3: WordKey("meet <UNDEF> 1") find all occurrences of meet that occur at LOCATION 1 in any DOCID. This can be inefficient since the search has to scan all occurrences of meet to find the ones that occur at LOCATION 1.

Ex4: WordKey("meet 2 <UNDEF>") find all occurrences of meet that occur in DOCID 2, at any location.

WordList is an abstract class and cannot be instanciated. See the WordCursorOne manual page for an actual implementation of a WordCursor object.