Commit Graph

42 Commits (c425d5533116cc5a623ee2c614a68bf8e13513f6)

Author SHA1 Message Date
voussoir 8ed5f0be51 Fix tag_expression usage of frozen_children which was tag objects.
At some point, I changed tag_export.flat_dict from using strings as
keys to using actual Tag objects as keys. The tag expression handler
never got updated, so frozen_children[tagname] raised KeyError as
it was looking for a string.
I considered using tag_expression_tree.map to convert all the tree
tokens into tag objects, but when we render the tree back into text
it will say "Tag:name" instead of just "name" throughout the whole
expression, and I don't want to deal with converting those back.
2020-09-09 12:58:57 -07:00
voussoir 7eb095e17c Experiment: Use width*height instead of area column when searching.
Will see if this has any adverse effects, or if it goes well I can
remove the area and ratio columns.
2020-09-08 21:59:42 -07:00
voussoir 0fdf08adf5 Fix bug where searching musts=[A, A.B] ignored B.
The problem was that during the expansion of A, B would get added to
the `total` set. And then because B was already in total, it would
bail early instead of expanding, but that meant it got left out of
the final query. But this only happened sometimes since random set
ordering would sometimes expand B before A and everything was ok.
I think the best solution is to do this first pass that eliminates
ancestors. Furthermore, I realized that the entirety of expand_nested
hinged on this flawed logic and was otherwise completely redundant
for a simple list comprehension.
2020-03-19 19:04:09 -07:00
voussoir 0a8a754cbc Replace set([]) with {}. 2020-03-19 17:40:52 -07:00
voussoir d66dc53215 Require voussoirkit 0.0.28 for sqlhelpers.listify.
Instead of defining that within etiquette.
2019-01-01 18:08:47 -08:00
voussoir dbdd509cd2 Rearrange imports so voussoirkit is right after lib imports.
Added a styleguide.md file to refer back to.
Since voussoirkit is a library it feels better to have it below
the rest of the library and above the local project imports.
2018-11-04 19:27:20 -08:00
voussoir 4c65ccaf68 Big! Liberate Groupables from strict heirarchy. Multiple parents.
I found that the strict heirarchy was not satisfying the situation
where one tag is the intersection of two others, but we can only
pick one as the parent

For example, does red_jacket belong under clothes.red_clothes or
clothes.jackets? A search for "red_clothes AND jackets" might
give us someone wearing red pants and a black jacket, so this
definitely needs to be a separate tag, but picking only one
parent for it is not sufficient. Now, a search for red_clothes
and a search for jackets will both find our red_jacket photo.

The change also applies to Albums because why not, and I'm sure
a similar case can be made.

Unfortunately this means tags no longer have one true qualname.
The concept of qualnames has not been completely phased out but
it's in progress.

This commit is very big because I was not sure for a long time
whether to go through with it, and so much stuff had to change
that I don't want to go back and figure out what could be grouped
together.
2018-07-20 13:09:06 -07:00
voussoir 4987db4bd0 Switch to f-string formatting in many places. 2018-07-18 18:36:36 -07:00
voussoir 028a8cb2ef All of the INTERSECTs can just be WHERE clauses. 2018-04-04 22:08:08 -07:00
voussoir da47b5bb3c Fix several small, embarassing typos. 2018-03-23 01:18:43 -07:00
voussoir 0e3ae11610 Improve normalizers, use less None; Add author search box.
It was getting difficult to remember which of the normalizers
use None and which don't. So let's try to be a little more consistent
and just use empty sets, etc, so the caller can rely on receiving a
set instead of having to check for None.

Also renamed search parameter authors->author to be more in line
with the singular form of extension.
2018-03-22 21:09:21 -07:00
voussoir 5be174d1b3 Completely rewrite search to use more SQL and less application.
In order to achieve tag_musts, we break each of the musts down
into separate EXISTS queries for each of the matchable children.
Then we INTERSECT those, and finally do other filtering and
ordering as usual.
2018-03-21 19:20:43 -07:00
voussoir 6c77ddd1c3 searchhelpers.normalize_author use un only, not IDs.
I don't like the idea of a user setting their username to be
someone else's ID.
2018-03-21 13:21:25 -07:00
voussoir afc5f38a8d Combine normalize_limit, _offset to normalize_positive_integer. 2018-03-21 11:25:21 -07:00
voussoir 1d76b4511b Let PDB.get_tag convert normalization errors to NoSuch.
Instead of having to account for them on the other end,
since they don't care about that stuff anyway.
2018-03-21 11:03:58 -07:00
voussoir 1cd78a678b Minor linter appeasements. 2018-03-11 01:54:59 -08:00
voussoir c99e783d04 Rename comprehension variable to not look like a conflict.
The existing code worked fine, but it was odd to see that `tag`
was both the loop variable as well as the key into the children.
So let's change it.
2018-03-11 01:35:35 -08:00
voussoir 633dbfa3cf Fix typo, searchhelpers.py is a file. 2018-03-10 14:42:33 -08:00
voussoir 5f6d21fdee Give Photos a `searchhidden` property.
By default, photos with searchhidden do not appear in the search
results. This allows a small number of representative images from
a large album to appear in the results, while the rest can be
found on the album's page.

The same effect could be achieved with a tag and forbid search,
but tag searching has much higher cost and it would be more difficult
to implement as a default behavior without requiring lots of special
checks whenever listing tags etc.
2018-03-09 17:10:27 -08:00
voussoir f34164bf85 Add search feature has_thumbnails.
Search needs a complete refactor.
But until then, let's keep adding to it!
2018-02-24 23:06:25 -08:00
voussoir 1c1e7f158f Minor fixes & pylint appeasements. 2018-02-16 21:28:36 -08:00
voussoir 6cf355d7ce Rename comma_split to comma_space_split to better describe behavior. 2017-12-07 20:58:06 -08:00
voussoir a7b5a7d42a Multiple small cleanups, docstrings, messages, lint improvements. 2017-11-27 15:56:16 -08:00
voussoir 96856e9361 Cleanup: More minor dusting, commenting, clarity renaming. 2017-11-11 22:49:03 -08:00
voussoir 3f69a2c240 Cleanup: Replace "objectid" with "object_id" in the Python portions. 2017-11-11 22:38:51 -08:00
voussoir 121f8329fb improve normalize_authors text 2017-09-29 14:32:35 -07:00
voussoir 0849796986 Make `build_query` params all optional, more kwargy. 2017-09-23 11:22:05 -07:00
voussoir 855e94ed87 Make `wheres` a set instead of list. 2017-09-23 11:20:38 -07:00
voussoir 557f78eb02 Integrate author search into the query instead of postprocessing.
Much faster this way.
2017-09-23 11:04:26 -07:00
voussoir 38e72c0c3a Make `notnulls` set instead of list. 2017-09-23 11:00:37 -07:00
voussoir 5b7c05c39d Improve MMF search speed by pre-filtering photo IDs
Not perfected yet but it's an improvement.
Waste less time checking all photos, presearch for matching photos via photo_tag_rel table.
2017-05-01 21:27:54 -07:00
voussoir 241d1466eb Fix tag expression bugs, move work to searchhelpers
Fix handling of bad tags, bad syntax, empty expression. Remove unnecessary warning_bag from matcher builder
2017-03-31 21:52:49 -07:00
voussoir b69ef8ea00 Cleanup some pylint 2017-03-23 15:11:28 -07:00
voussoir 8793d9ff41 Fix docstrings over 80 characters 2017-03-19 17:34:19 -07:00
voussoir db628d158e Shorten lines longer than 100 characters 2017-03-14 21:18:42 -07:00
voussoir c04b5a6db0 Remove unnecessary warning_bag code from normalize_tagname 2017-03-05 04:54:58 -08:00
voussoir 888c3b48cd Completely revise exception message formatting technique 2017-03-04 21:56:23 -08:00
voussoir c3a4fa443b Rename variable 'row_tuple' to 'db_row'; Improve some docstrings 2017-03-03 21:15:31 -08:00
voussoir fcc671a617 Move many errors + warnings to properties of Exception classes 2017-02-26 01:04:07 -08:00
voussoir 5404a1d411 checkpoint
fix bug in which renaming photo causes os.remove even when it's an in-place rename on case-insensitive systems; incorporate expressionmatch for filename search; minor comment cleanup
2017-02-25 22:47:20 -08:00
voussoir c80e2003ff checkpoint
add photo and search css for narrow screens; incorporate new expressionmatch kit; entry_with_history cursor moves to end; albums indicate total filesize; etc
2017-02-24 22:07:59 -08:00
voussoir c84acca6c9 Move modules into an actual package 2017-02-04 19:55:13 -08:00