Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All: gsoc project - Add search filters #3213

Merged
merged 51 commits into from
Aug 7, 2020
Merged

All: gsoc project - Add search filters #3213

merged 51 commits into from
Aug 7, 2020

Conversation

naviji
Copy link
Contributor

@naviji naviji commented May 15, 2020

I ported all the existing filters into the new implementation.
I also added a new filter on tags.
tag: docs tag:gsoc

@naviji naviji changed the title All: GSOC Project - New filters All: gsoc project - Add search filters May 15, 2020
CliClient/tests/services_SearchFilter.js Outdated Show resolved Hide resolved
ReactNativeClient/lib/services/filterParser.ts Outdated Show resolved Hide resolved
ReactNativeClient/lib/services/filterParser.ts Outdated Show resolved Hide resolved
ReactNativeClient/lib/services/filterParser.ts Outdated Show resolved Hide resolved
ReactNativeClient/lib/services/queryBuilder.ts Outdated Show resolved Hide resolved
ReactNativeClient/lib/services/queryBuilder.ts Outdated Show resolved Hide resolved
ReactNativeClient/lib/services/queryBuilder.ts Outdated Show resolved Hide resolved
@naviji
Copy link
Contributor Author

naviji commented May 20, 2020

Refer https://discourse.joplinapp.org/t/database-speed-test-results/8766 for reasons for changing notes_fts virtual table and the SQL search query.

Copy link
Owner

@laurent22 laurent22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @naviji, overall it's looking good so far. I've just left a few comments below.

CliClient/tests/queryBuilder.js Outdated Show resolved Hide resolved
CliClient/tests/filterParser.js Show resolved Hide resolved
CliClient/tests/services_SearchFilter.js Show resolved Hide resolved
@laurent22
Copy link
Owner

laurent22 commented Jun 27, 2020

Thanks for the update @naviji. I see the pull request is still with draft status, does it mean you are still planning to do more work on it?

Also, as this is a complex pull request, it would help if you document how it currently works:

  • How does the new database structure look like?
  • What are the classes you've created, and what do they do?
  • How do they interact with each others, and how they are integrated to the code base?
  • Also please update the filter table (if you haven't already done so), and link to it from here.

Your code seems to be quite modular and well organised, which is great, but additional doc like this would help approach the pull request. It can be UML diagrams, Markdown or whatever format you prefer to use as long as it's clear.

@laurent22
Copy link
Owner

Also we need to think how we can release this. The issue is that it's not a feature we can put behind a beta flag like the Code MIrror editor, as there are major database changes and it affects desktop, mobile and cli apps.

So what I think is that we'll do a pre-release with it but we'll make sure that the implementation is very stable (nearly production ready), so we'll rely on your test units and some extra manual testing.

By the way, did you test on mobile and cli so far?

@naviji
Copy link
Contributor Author

naviji commented Jun 28, 2020

@naviji naviji marked this pull request as ready for review July 1, 2020 03:37
@laurent22
Copy link
Owner

Please let me know when it's ready to review.

@naviji
Copy link
Contributor Author

naviji commented Jul 7, 2020

:search -- "-tag:tag1" will escape the string so we can use negated filters in CliClient.

I'll mention this in the docs.

Comment on lines 116 to 123
goBackInTime(n, timeDuration) {
// Note that we are starting from the first ms of the current timeDuration
// eg. If we go back by one day we are subtracting (24*60*60*1000) ms from the start ms of today
return moment().startOf(timeDuration).subtract(n, timeDuration).format('x');
}

goForwardInTime(n, timeDuration) {
return moment().startOf(timeDuration).add(n, timeDuration).format('x');
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a first argument to these function, please pass the date that should go forward/backward. Also please clarify what is "n" (possible values, unit) and what is timeDuration (possible values, unit, as from your code it seems to be "day", "hours", etc. but from your example it seems to be milliseconds).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find tests for these two functions. Please add some if you haven't already done so.

Copy link
Contributor Author

@naviji naviji Jul 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I modified the function and added some clarification.

Where should I place the tests? I can't find any existing tests for timeUtils functions.
Also, do we need a unit test here as we're just calling moment.js functions as per its doc? I haven't written any additional logic.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case please create a new file for it. For example duplicate tests/ArrayUtils.js and rename to tests/timeUtils.js. Even though it's relatively straightforward implementation of the moment.js api, it's still good to have a test units to specify what cases exactly we support. It would also be useful if for whatever reason we change from moment.js to another time library.

@laurent22
Copy link
Owner

@naviji, there's a conflict on the migrations due to some issue with a recent pull request that had to be reverted. I think you just need to adjust the migration number to fix the conflict.

@laurent22
Copy link
Owner

By the way, did you have the opportunity to test the feature on mobile and CLI?

@naviji
Copy link
Contributor Author

naviji commented Jul 29, 2020

Yes, I did test on mobile and cli.

@naviji naviji changed the base branch from master to dev August 3, 2020 02:34
@laurent22 laurent22 merged commit f99f3f8 into laurent22:dev Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants