anki/rslib
Abdo 946eb46813
Add option to exclude fields from search (#2394)
* Add option to exclude fields from unqualified searches

* Use temp tables instead

This is slightly faster according to my (very rough) tests.

* Make query a bit more readable

* exclude_from_search -> excludeFromSearch

* Remove superfluous notetypes table from query

* Rework to use field search logic

Thanks to Rumo for the suggestion: https://github.com/ankitects/anki/pull/2394#issuecomment-1446702402

* Exclude fields from field searches too

* Fix error on notetypes with no included fields

* Add back the exclude_fields function

This approach seems to perform better on average than the previously
benchmarked ones.

* Use pure-SQL approach to excluding fields

* Change single field search to use new approach

* Fix flawed any_excluded/sortf_excluded logic

* Support field exclusion in the nc operator

Also fix search text being wrapped in % in the any_excluded=true case.

* Support field exclusion in the re and w operators

* Label field exclusion as being slower

* Unqualified search should be wrapped in % in all cases

I was under the impression that it shouldn't be wrapped with the new
field exclusion logic.

* Remove unnecessary .collect()

* Refactor some complex return types into structs

* Do not exclude fields in field searches

* Add a test and docstring for CollectRanges

* Avoid destructuring in closures

* Remove the exclude_fields function

Minor wording tweaks by dae:
* num_fields -> total_fields_in_note
* fields -> field_ranges_to_search
* fields -> fields_to_search
* SingleField -> FieldQualified
* mid -> ntid
2023-03-20 07:46:03 +10:00
..
ascii_percent_encoding Update crate name in docstrings to fix 'cargo test' 2022-12-16 22:30:54 +10:00
benches Switch Rust import style (#2330) 2023-01-18 21:39:55 +10:00
build Deck scoped dupe check (#2372) 2023-02-16 17:53:36 +10:00
i18n Trigger rebuild on STRINGS_JSON change 2023-02-17 19:03:33 +10:00
i18n_helpers Add Rust bin to deprecate unused ftl entries (#2364) 2023-02-07 11:56:14 +10:00
linkchecker Check URLs in TS code (#2436) 2023-03-15 15:46:03 +10:00
src Add option to exclude fields from search (#2394) 2023-03-20 07:46:03 +10:00
tests/support move linkchecker into separate crate 2021-12-20 17:27:43 +10:00
.gitignore initial Bazel conversion 2020-11-01 14:26:58 +10:00
bench.sh New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
Cargo.toml Implement TTS using windows crate (#2371) 2023-02-17 12:26:07 +10:00
README.md Move away from Bazel (#2202) 2022-11-27 15:24:20 +10:00

Anki's Rust code.