@@ -13,6 +13,8 @@ Returns exitcode 1 when no match is found, unless the '--not-one' flag is used.
1313When --quick is enabled, no output is produced and exitcode 0 is returned on
1414the first match.
1515
16+ When the CSV is indexed, a faster parallel search is used.
17+
1618For examples, see https://github.com/dathere/qsv/blob/master/tests/test_search.rs.
1719
1820Usage:
@@ -53,7 +55,7 @@ search options:
5355 N milliseconds, whichever occurs first. Returns the preview to
5456 stderr. Output is still written to stdout or --output as usual.
5557 Only applicable when CSV is NOT indexed, as it's read sequentially.
56- If the CSV is indexed, the --preview-match option is not supported .
58+ Forces a sequential search, even if the CSV is indexed .
5759 -c, --count Return number of matches to stderr.
5860 --size-limit <mb> Set the approximate size limit (MB) of the compiled
5961 regular expression. If the compiled expression exceeds this
@@ -168,9 +170,11 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
168170 . no_headers ( args. flag_no_headers )
169171 . select ( args. flag_select . clone ( ) ) ;
170172
171- // Route to parallel or sequential search based on index availability
173+ // Route to parallel or sequential search
174+ // based on index availability, number of jobs, and --preview-match option
172175 if let Some ( idx) = rconfig. indexed ( ) ?
173176 && util:: njobs ( args. flag_jobs ) > 1
177+ && !args. flag_preview_match . is_some ( )
174178 {
175179 args. parallel_search ( & idx, pattern, & rconfig)
176180 } else {
0 commit comments