Returns the total number of documents matching a query and optional filter, ignoring any result limit.
Arguments
- idx
A
tnt_index.- query
A query string in tantivy's query syntax. The empty string
""matches all documents (useful withfilter).- fields
<
tidy-select> Text fields searched for bare (unqualified) query terms. Defaults to all indexed text fields.- filter
Either a tantivy query string, or a comparison expression such as
year >= 2020 & source == "globo". Supported operators:==,%in%,>,>=,<,<=, combined with&and|.
Examples
idx <- tnt_index_df(
data.frame(t = c("apple pie", "apple tart", "banana bread")),
text = t, stemmer = "english"
)
tnt_count(idx, "apple")
#> [1] 2