COUNT_HITS
Returns the number of hits for the specified query. You can call COUNT_HITS in exact or estimate mode. Exact mode returns the exact number of hits for the query. Estimate mode returns an upper-bound estimate but runs faster than exact mode.
Syntax
Syntax 1
exec CTX_QUERY.COUNT_HITS(
index_name IN VARCHAR2,
text_query IN VARCHAR2,
exact IN BOOLEAN DEFAULT TRUE,
part_name IN VARCHAR2 DEFAULT NULL
) RETURN NUMBER;
Syntax 2
exec CTX_QUERY.COUNT_HITS_CLOB_QUERY(
index_name IN VARCHAR2,
text_query IN CLOB,
exact IN BOOLEAN DEFAULT TRUE,
part_name IN VARCHAR2 DEFAULT NULL
) RETURN NUMBER;
index_name
Specify the index name.
text_query
Specify the query.
exact
Specify TRUE for an exact count. Specify FALSE for an upper-bound estimate.
Specifying FALSE returns a less accurate number but runs faster. Specifying FALSE might return a number which is too high if rows have been updated or deleted since the last FULL index optimize. Optimizing in full mode removes these false hits, and then EXACT set to FALSE will return the same number as EXACT set to TRUE.
part_name
Specify the name of the index partition to query.
Notes
If the query contains structured criteria, then you should use SELECT COUNT(*).
If the index was created with the TRANSACTIONAL parameter, then COUNT_HITS will include pending rowids as well as those that have been synchronized.