Commit graph

70 commits

Author SHA1 Message Date
Damien Elmes
b63ac7e80d turn off not after application 2012-05-23 20:54:03 +09:00
Damien Elmes
6af7f6e846 improved finding
- new per-character tokenizer that is easier to read and maintain
- OR searches now supported
- grouping with ( and ) now supported
- sorting is off by default now
- searching in html is disabled for now, but may come back later
- use ? arguments instead of named arguments to ease porting to other
  platforms
- field:foo is no longer wrapped in implicit wildcards
- avoid joining notes table if it not required - about 30% faster
- fixed sql injection bug in findNids()
- commands no longer have to take care of negation themselves
- commands can return nothing to immediately flag the query as invalid
2012-05-23 20:21:47 +09:00
Damien Elmes
ef4ff86f8c support searches for particular ratings 2012-05-23 14:39:30 +09:00
Damien Elmes
3755a8f82d support matches on card properties 2012-05-23 14:18:44 +09:00
Damien Elmes
a76d34dc19 fix error on negated invalid is: 2012-05-23 13:39:25 +09:00
Damien Elmes
82ead398db field:foo searches should be case insensitive 2012-05-22 06:35:04 +09:00
Damien Elmes
28b5a108f6 wildcard deck searches 2012-05-21 11:45:24 +09:00
Damien Elmes
26f3ab7b9f due sort should sort by type first 2012-05-18 12:02:00 +09:00
Damien Elmes
58257cb5c4 add deck:none 2012-05-05 23:34:11 +09:00
Damien Elmes
0faad28715 fix negation of normal searches 2012-05-05 00:28:14 +09:00
Damien Elmes
58aebc5b55 genCards() on findReplace() 2012-04-25 13:24:54 +09:00
Damien Elmes
5514b75d6b fix card:<n> and card:cloze in cloze types 2012-04-24 02:30:02 +09:00
Damien Elmes
fbefb8a906 remove is:recent 2012-04-17 18:31:46 +09:00
Damien Elmes
bbac32b477 ensure lapsed reviews are scheduled for tomorrow on graduate 2012-04-07 14:28:41 +09:00
Damien Elmes
2f75e99671 ntype -> note 2012-04-07 13:53:55 +09:00
Damien Elmes
2ba5f80cf1 fix field searching and negated field searching 2012-04-07 13:53:03 +09:00
Damien Elmes
73bdad9d70 model:foo is ntype:foo in searches now 2012-03-30 00:03:39 +09:00
Damien Elmes
f7fe1c6590 fix tag:none 2012-03-27 11:18:16 +09:00
Damien Elmes
ccb0c08c9c another find&replace bug 2012-03-24 19:03:14 +09:00
Damien Elmes
ce86670c76 find&replace should ignore notes without provided field 2012-03-24 04:06:51 +09:00
Damien Elmes
f1140cf886 fix inverted deck search case 2012-03-20 02:49:06 +09:00
Damien Elmes
7c712274d8 deck: searches should find it both original and current deck 2012-03-19 22:53:40 +09:00
Damien Elmes
820308e45e fix args in addSearchFieldToken 2012-03-19 21:50:09 +09:00
Damien Elmes
01404fafaa start of cram refactor 2012-03-08 16:47:22 +09:00
Damien Elmes
4f1bcb9356 fix is:recent 2012-01-24 01:04:49 +09:00
Damien Elmes
a9c46b5ccb include subdecks when restricting to deck 2011-12-15 11:57:55 +09:00
Damien Elmes
95106908dd check sort field when searching
If the field they want to search is the one being used to sort, this saves us
having to go the full search route
2011-12-08 09:53:27 +09:00
Damien Elmes
74518264e0 raise an exception when an invalid sort type is passed 2011-11-30 12:34:49 +09:00
Damien Elmes
be3258b0a8 fix field limiting 2011-11-28 20:51:47 +09:00
Damien Elmes
73b80211c2 add current deck limit 2011-11-28 20:48:14 +09:00
Damien Elmes
8c1266ab2a less terse card state searches 2011-11-28 20:18:16 +09:00
Damien Elmes
67e4f0d1cc tweak find code 2011-11-28 20:04:39 +09:00
Damien Elmes
f7790275ce groups -> decks 2011-11-23 19:28:09 +09:00
Damien Elmes
279a942642 deck -> collection 2011-11-23 17:47:44 +09:00
Damien Elmes
6e4e8249fb facts -> notes 2011-11-23 12:37:21 +09:00
Damien Elmes
bc9f6e6a24 add USNs
Decks now have an "update sequence number". All objects also have a USN, which
is set to the deck USN each time they are modified. When syncing, each side
sends any objects with a USN >= clientUSN. When objects are copied via sync,
they have their USNs bumped to the current serverUSN. After a sync, the USN on
both sides is set to serverUSN + 1.

This solves the failing three way test, ensures we receive all changes
regardless of clock drift, and as the revlog also has a USN now, ensures that
old revlog entries are imported properly too.

Objects retain a separate modification time, which is used for conflict
resolution, deck subscriptions/importing, and info for the user.

Note that if the clock is too far off, it will still cause confusion for
users, as the due counts may be different depending on the time. For this
reason it's probably a good idea to keep a limit on how far the clock can
deviate.

We still keep track of the last sync time, but only so we can determine if the
schema has changed since the last sync.

The media code needs to be updated to use USNs too.
2011-09-13 21:10:21 +09:00
Damien Elmes
78600e8ed6 move group code into a registry like models 2011-08-27 23:45:55 +09:00
Damien Elmes
d3a3edb707 move models into the deck table
Like the previous change, models have been moved from a separate DB table to
an entry in the deck. We need them for many operations including reviewing,
and it's easier to keep them in memory than half on disk with a cache that
gets cleared every time we .reset(). This means they are easily serialized as
well - previously they were part Python and part JSON, which made access
confusing.

Because the data is all pulled from JSON now, the instance methods have been
moved to the model registry. Eg:
  model.addField(...) -> deck.models.addField(model, ...).

- IDs are now timestamped as with groups et al.

- The data field for plugins was also removed. Config info can be added to
  deck.conf; larger data should be stored externally.

- Upgrading needs to be updated for the new model structure.

- HexifyID() now accepts strings as well, as our IDs get converted to strings
  in the serialization process.
2011-08-27 22:27:09 +09:00
Damien Elmes
7afe6a9a7d convert groups to json; use timestamp ids for all but default
Rather than use a combination of id lookups on the groups table and a group
configuration cache in the scheduler, I've moved the groups and group config
into json objects on the deck table. This results in a net saving of code and
saves one or more DB lookups on each card answer, in exchange for a small
increase in deck load/save work.

I did a quick survey of AnkiWeb, and the vast majority of decks use less than
100 tags, and it's safe to assume groups will follow a similar pattern.

All groups and group configs except the default one will use integer
timestamps now, to simplify merging when syncing and importing.

defaultGroup() has been removed in favour of keeping the models up to date
(not yet done).
2011-08-27 17:13:04 +09:00
Damien Elmes
644a885a07 update fact ids, graves
- should never skip recording graves, for the sake of merging
- 1.0 upgrade will fail on decks that have the same fact creation date. need
      to work around this in the future
2011-08-26 21:23:16 +09:00
Damien Elmes
a65f241258 gracefully handle invalid queries 2011-04-29 11:46:26 +09:00
Damien Elmes
2243b691cc add full search to ignore formatting 2011-04-28 09:24:03 +09:00
Damien Elmes
8b747c3aac allow the user to choose if case should be folded 2011-04-28 09:24:03 +09:00
Damien Elmes
bee14e1a0b make fieldNames() available for gui code too 2011-04-28 09:24:03 +09:00
Damien Elmes
d51cd5a433 find & replace 2011-04-28 09:24:03 +09:00
Damien Elmes
8c1c729544 fix card state negation 2011-04-28 09:24:02 +09:00
Damien Elmes
437b4780c0 add missing cardIvl sort 2011-04-28 09:24:02 +09:00
Damien Elmes
1b3548f164 fix sorting by ease 2011-04-28 09:24:02 +09:00
Damien Elmes
2a225b1fae use the sort property set in the deck 2011-04-28 09:24:02 +09:00
Damien Elmes
d089deae5a add the ability to reverse sort order 2011-04-28 09:24:02 +09:00