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
Feature/extended search #36
Feature/extended search #36
Conversation
Hi @iain-benson, thanks for the PR. As you might have noticed, development is a bit slow these days, so it could take a while before @luisangelsm can check the code. There's also some stuff in the code that will likely require some discussion, such as switching to C++17 and adding an embedded library to the codebase. |
First of all, thank you very much for the PR, it is really appreciated. This is something that has been in the TODO list for so long that it is great to finally see something done about it. I didn't have time to fully review this yet, but I have the same concerns expresed by @selmf. @iain-benson could you post here an example of a search string? I would like to think about the posiblity of write a small class to take care of the lexical parsing, it shouldn't be hard and it will be easier to mantain in the long term. Another thing that comes to my mind is that the fields used in the query parser should be defined in a single place only, so maybe it is time to do something in the database source code so these fields can be imported directly into the query parser, so further changes/updates in the database won't requiere updating the query parser fields manualy. |
fadd855
to
192cf89
Compare
A couple of things need to be done before merging this:
I will take care of this at some point, if anyone is interested please ping me. |
Apologies for having somewhat abandoned this, I just haven't had the time to revisit it, other than to fix an issue I found with string streams after moving to a newer version of Xcode. I understand why you want to get rid of Fixing the input lag on queries, either by threading, or possibly a simple hold-off whilst still typing, was something I had realised needed doing, but never quite got around to, I was also planning to implement query operators (as with the syntax at https://manual.calibre-ebook.com/gui.html#the-search-interface) rather than everything being |
@iain-benson no worries :) Even if you can work any more on it, it is a good starting point. An user expresed interest in continue the work, but I didn't hear anything else from him, so I am not sure about the current status. |
4e5526f
to
8efb991
Compare
There have been some changes to the DB code and this PR was conflicting with the current implementation. I rebased it and fixed the conflicts, hopefully I didn't break anything. I'll try to finish otherwise it won't survive as conflicts will get harder to fix :/ and it is a feature that has been requested a lot. |
This was broken while doing a rebase
QueryLexeter does not parse "atWord" because I couldn't find what it is used for.
Thank you for finishing this off. I knew there were issues with it stopping it being accepted, I just haven’t had the opportunity to look at it. |
@iain-benson thank you for starting it :), it needs some more work though, requesting data from the DB should be done in a background thread. I am working on it now and hopefully I'll be able to merge it in a few a days. Now that I have your attention, do you remember what |
I don’t think it’s needed. I think it’s part of a feature used in Calibre’s python code, related to custom database fields, that I mistakenly put in despite not being used. |
`atWord` wasn't used at all and spaces should be eaten by the lexer And added `unspecified` token
List initialization ended using movable constructors which surprisingly caused data troubles in release mode, at least in VC2019 compiler. The tree being messed up caused crashes while SQL was generated. I have no explanation for it.
Just to keep things consistent in the whole round trip conversion
It uses the same approach used by the comics search filter
It is probably worth to bump this to c++14 and ideally use c++17, but it will be done in a separate branch.
The lexer itself should be responsible for parsing those values but it will require a bigger refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could use some more work but it seems to work good enough now.
|
||
selectQuery.exec(); | ||
QLOG_ERROR() << "-d2>" << data->size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this line left here by mistake? It spams error messages every time the search edit's text changes to a non-empty value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this line be removed or converted to QLOG_TRACE
or QLOG_DEBUG
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, I used that log to catch some issues while I was working on this PR but it doesn't have a purpose anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in #194.
Extend the search facility to allow Boolean logic, and a lot more fields to be searched.