Commit Graph

102 Commits

Author SHA1 Message Date
ksqsf
bfe7f5e826 fix: lint 2023-12-04 13:46:04 -05:00
ksqsf
ef60c92e30 fix: and-or query 2023-12-04 13:46:04 -05:00
Tienson Qin
86c5376eb8 fix: disable reactive query in api/q 2023-04-12 23:57:05 +08:00
Tienson Qin
db6fc6b7ee feat: simple query builder (#8774)
Simple query builder

---------

Co-authored-by: Gabriel Horner <gabriel@logseq.com>
Co-authored-by: charlie <xyhp915@qq.com>
2023-03-21 14:27:00 +08:00
Gabriel Horner
17f51c7b77 Make resolve-input nbb compatible
- Brought back Xd-{before,after}-ms and tested it
- Move it to its own ns in graph-parser
- Updated nbb-logseq in deps/
- Made db-utils alias consistent
- Organized resolve-input
2023-01-07 02:49:07 -05:00
Gabriel Horner
9d9e976b8c Merge branch 'master' into refactor/refs-from-property-values 2022-09-21 15:34:47 -04:00
Gabriel Horner
60067cb817 Disable sorting if query contains and there is no default sorting
- Also fixed caret not showing up when sorting occurs by default for
  a default sorting state coming from :query-sort-by and
  :query-sort-desc
- Also cleaned up sort state. Rum local state doesn't seem necessary
2022-09-20 12:20:17 -04:00
Gabriel Horner
91d6d14720 Fix sort-by not working for blocks
- Also add sort-by support for pages which fixes #5643
- Add sort-by tests
- Fix sample producing weird queries e.g. mixed block and page clauses
- Clean up last, hard to read test setup in query-dsl
2022-09-20 12:20:17 -04:00
Tienson Qin
040fd5510f fix: some tests on graph_parser 2022-09-09 12:39:26 +08:00
Tienson Qin
f29ff96778 fix: CI errors 2022-09-09 12:37:57 +08:00
Tienson Qin
d1d1dc50c2 wip: get references from property values 2022-09-09 12:36:54 +08:00
Gabriel Horner
39b43b363c Fix page-properties bug and dsl-query bug
parser test caught page properties bug and dsl-query tests once written
correctly exposed another bug. Also remove unit test as they are
replaced by integration style tests in graph-parser-test
2022-08-11 16:32:00 -04:00
Gabriel Horner
0719163d30 Split out parse-property for use in dsl-query and tests
- Add tests for all *property dsl queries with and without new
  config option
- Add tests for property persistence
- Add tests for property relationships
2022-08-11 16:32:00 -04:00
Gabriel Horner
e0b1f6b2de Move common uses of page-ref to its own ns
By having a specific ns for page-ref utils, our code is more readable
and intention revealing. Also found that
text/{get-page-name,page-ref-un-brackets!} was getting called in
contexts that didn't make sense e.g. query layer was checking for
markdown and org page-refs
2022-08-04 17:25:29 +08:00
Tienson Qin
a1ca6820df Fix: broken linked references (#6105)
* enhance: clicking the refresh button if a query is slow

* fix: skip running slow queries if there's no need to refresh

* fix: linked reference filtering does not work on TASK items

close #1669

* fix: each block should have its own page as a reference when query page references

* fix: references

* fix: non consecutive blocks in query result and filtered linked references

* simplify filters logic

* fix: ref numbers

* Save both :block/refs and :block/path-refs for different usage

* fix: block refs

* enhance: move scheduled and deadlines to its own ns

* linked references performance tweaks

* mouse hover filters icon to expand the collapsed linked refs

* perf: react/refresh! once instead twice

* enhance: compute flashcards every hour instead of every 5s

* feat: macros as blocks

* feat: flashcards list

* fix: refed pages count

* fix: can't select in linked references

* fix: block editing on linked refs

* perf: editing in linked references

* enhance: update srs cards number when clicking flashcards

* Add a test for the case fixed in #6100

* Address feedbacks from Gabriel

* fix: Block Ref Indicator is missing from the references-blocks class

close #5375

* fix: referenced pages

* fix: page refs

* fix: Using filters pushed the title property to the second block

close #5845

Co-authored-by: Gabriel Horner <gabriel@logseq.com>
2022-08-04 13:03:12 +08:00
Peng Xiao
d271b85a51 fix: should only log query when debug is enabled 2022-07-20 11:55:17 +08:00
Gabriel Horner
17d2462343 Move rules into db dep as it's useful for external apps
- rules is already used by logseq-query and will be useful for
  nbb-logseq
- Updated db jobs to run in deps/db by default. Less typing but
  more importantly discourages independent libraries from depending on
  external scripts.
- Moved lint-rules task into db since it is db specific now
- Also remove nbb-logseq from top-level as all nbb compatibility is in
  deps.
2022-06-10 15:39:11 +08:00
Gabriel Horner
15b8e5e9df Setup CI jobs that are only for graph-parser
Also move all non graph-parser fns to frontend thanks to carve lint
2022-05-26 18:04:45 -04:00
Gabriel Horner
fec0b755a8 Upgrade cljs + shadow
- Upgraded shadow to keep goog compiler versions the same
- Converted some safe-parse-int's to parse-long
- Converted some safe-parse-float's to parse-double
- Simplified impl of safe-parse-* fns
2022-05-19 14:58:33 +08:00
Tienson Qin
7f256b8872 fix: sample query 2022-05-16 15:35:43 +08:00
Gabriel Horner
5b0d5fb8b5 Decouple graph-parser util from app util usage
For tiny util heavily used fns like safe-re-find and uuid-string?,
decouple graph-parser from so much of the app
2022-05-13 16:17:44 -04:00
Gabriel Horner
65804b4183 Split out text ns to graph-parser 2022-05-10 20:22:48 -04:00
Gabriel Horner
85bd1fecb2 Move first batch of util fns to graph-parser.util
Still need to fix external.roam
2022-05-04 12:02:36 -04:00
Gabriel Horner
6b935a8d58 Fix page-ref rule which was not bindable and failed fast
- page-ref had a :block/name embedded lookup ref which failed fast.
  datomic advises against this -
  https://docs.datomic.com/on-prem/schema/identity.html#:~:text=You%20cannot%20use%20them%20in%20the%20body%20of%20a%20query%2C%20use%20datalog%20clauses%20instead
- page-ref can handle binding args like last commit for page
- page-ref not failing fast on non-existing pages means that user can get meaningful results
  in more complex queries as seen in test
- Also remove try/catch as there should be no more queries that
  unintentionally cause the 'Nothing found for entity' error
- Also fixed lookup ref in srs cards which can be seen in stacktrace of
  #4576
2022-03-17 16:15:04 +08:00
Gabriel Horner
96da98e5bd Fix Tienson's nested not case 2022-03-16 16:04:59 +08:00
Gabriel Horner
a41dd0abfc Remove parse catch for consistent error handling
For advanced queries we error when invalid queries are written. We
should do the same for simple query.
Also add a test for tag query format
2022-03-16 16:04:59 +08:00
Gabriel Horner
e615423e6a Fix full text search without quotes not working
Decoupled query-dsl from search/block-search. This coupling added
unnecessary complexity as srs, custom queries and the api all depend
on query-dsl and don't need to be coupled to search/block-search
2022-03-16 16:04:59 +08:00
Gabriel Horner
8468602881 query-dsl + tests cleanup
Remove old string checks that no longer apply. Also added another blank
string case that causes an issue
2022-03-16 16:04:59 +08:00
Gabriel Horner
5f0efcf2d8 Fix another nested boolean case
Also removed or nested complexity from
903a757ce2 that no longer seems necessary
2022-03-16 16:04:59 +08:00
Gabriel Horner
3a19687988 Fix nested boolean case - close #4510 2022-03-16 16:04:59 +08:00
Gabriel Horner
6a1bcec82c Make db/query react aliases consistent
These namespaces had conflicting aliases which led to confusing reading
2022-03-10 15:43:07 +08:00
Gabriel Horner
79bbf21f7d Allow advanced queries to pull in dsl rules as needed
- Remove unused query' and when checks from custom-query
- Update bb command to use correct watch
- Provide $EXAMPLE mode in query dsl test to document rule usage
2022-03-10 15:43:07 +08:00
Gabriel Horner
d955918525 Display explicit error for one remaining react-query (advanced query)
This is a follow up to #4434. I've now confirmed that all uses of
react/react-query benefit from an explicit exception as they will now
see an explicit error instead of 0 results which is confusing for the
user and harder for us to debug
2022-03-09 14:10:38 +08:00
Gabriel Horner
2286ef71bc Rules must be present for srs since it uses the same dsl-query helper
Closes #4497 and #4500
2022-03-09 14:10:38 +08:00
Gabriel Horner
f9cb132482 Fix simple queries not working in advanced query - close #4498
Also removed unused repo fn in query-dsl ns and configured custom-query
to throw exception
2022-03-09 14:10:38 +08:00
Gabriel Horner
4c777fc502 Convert remaining query operators to use rules
- Removed counter and uniq-symbol as those are no longer needed
- build-query cleanly maps conditions to their fns
- Query dsl tests have been fully decoupled
2022-03-08 16:27:30 +08:00
Gabriel Horner
198c3363f7 More query dsl improvements
- Add tests for 5 operators that weren't tested
- Converted all operators to rules except two
2022-03-08 16:27:30 +08:00
Gabriel Horner
bcfb9d99ee Move *page-tags operators to rules
Also converted their tests to the new format and finally made test-parse
small enough to be considered more readable
2022-03-08 16:27:30 +08:00
Gabriel Horner
80ef31f4c0 Fixes #4101 by moving todo/task and priority to rules
Task and priority weren't composable in most boolean settings. Rules
fixes that
2022-03-08 16:27:30 +08:00
Gabriel Horner
3987395ab5 Merge branch 'master' into fix/dsl-query-boolean-operators 2022-03-04 09:54:23 -05:00
Gabriel Horner
4eaca080dd Display error if dsl query fails hard
By making failure more explicit, it's easier for us to debug the type of
failure
2022-03-04 10:36:28 +08:00
Gabriel Horner
12395c61fb Introduce rules to query-dsl
Fixes #4217 as each use of page-property have unique bindings that don't
clobber each other
2022-03-01 16:46:27 -05:00
Gabriel Horner
b248c95ce3 Split out query operators that are tested 2022-03-01 16:42:19 -05:00
Gabriel Horner
c6d03b67ab Merge branch 'master' into dev/var-sizes-linter 2022-02-08 12:02:39 -05:00
Gabriel Horner
1df386ecca Add regression tests for querying properties with links
These tests were fixed by f1728c48cb

Also cleaned up more of query and tests i.e. split up large fns
2022-02-08 14:47:08 +08:00
Gabriel Horner
5a126027eb Fix #4007 to allow linked integer page links to match property query 2022-02-08 14:47:08 +08:00
Gabriel Horner
e81678fc69 Mark most vars as cleanup-todo
Fixed a few that I knew how to QA and were low risk
2022-02-04 16:57:49 -05:00
Tienson Qin
21f2237227 fix: lint errors 2022-01-16 13:06:54 +08:00
Tienson Qin
2401ce9e9a fix: property regression : # should be a delimiter
Close #3916

Tests added.
2022-01-16 12:39:41 +08:00
Gabriel Horner
7497d8b396 Lint a good chunk of src/main/frontend
Left some TODOs to discuss with others and others for me to finish
2022-01-11 17:34:54 -05:00