anki/proto/anki
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
..
ankidroid.proto Integrate AnkiDroid's backend patches into the repo (#2290) 2023-01-03 13:11:23 +10:00
backend.proto Implement TTS using windows crate (#2371) 2023-02-17 12:26:07 +10:00
card_rendering.proto Implement TTS using windows crate (#2371) 2023-02-17 12:26:07 +10:00
cards.proto Add card meta for persisting custom scheduling state (#2040) 2022-09-02 11:22:49 +10:00
collection.proto Integrate AnkiDroid's backend patches into the repo (#2290) 2023-01-03 13:11:23 +10:00
config.proto Remember previous choices in reposition dialog (#1950) 2022-07-08 11:28:38 +10:00
deckconfig.proto Revert bury restriction (#2432) 2023-03-11 17:49:18 +10:00
decks.proto Add non-legacy backend interface for adding new decks 2022-09-04 14:12:29 +10:00
generic.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
i18n.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
import_export.proto Deck scoped dupe check (#2372) 2023-02-16 17:53:36 +10:00
links.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
media.proto Add option to tag notes with missing media (#2379) 2023-02-20 18:48:09 +10:00
notes.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00
notetypes.proto Add option to exclude fields from search (#2394) 2023-03-20 07:46:03 +10:00
scheduler.proto Ensure state mutator runs after card is rendered (#2421) 2023-03-16 16:31:00 +10:00
search.proto Allow burying cards in browser (#2351) 2023-01-30 19:21:06 +10:00
stats.proto Show custom data in stats screen 2023-02-07 12:27:43 +10:00
sync.proto Allow the network timeout to be customized 2023-02-08 14:33:02 +10:00
tags.proto Add java_multiple_files option to proto files 2022-06-27 15:16:04 +10:00