-
Notifications
You must be signed in to change notification settings - Fork 11
Feature/relevant suggestions and more #1602
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Set default phrase boost divisor to a high number for now to make sure that the score from phrase matching isn't too big. * The number can and will be tuned with the temporary API parameter _phraseBoostDivisor. * Keep together boosting config to facilitate passing on config supplied via REST API.
This reverts commit 5296b54.
* Ensures that free text search within property works the same way as "simple" free text search * Don't flatten AST, control the tree structure with QueryTreeBuilder * Enables phrase searching within property * Multiple free text tokens are now held together when within brackets * WIP: Introduce new (structured) Value types: Numeric, Date
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on libris/lxlviewer#1328.
Mainly solves https://kbse.atlassian.net/browse/LWS-272. The API should now continually respond with relevant suggestions depending on which part of the query is being edited, given that the current query string
_q
is accompanied with supplementary API parameters_suggest=true
andcursor=i
wherei
is the current cursor position.Basically much of the "supersearch" machinery has been moved from frontend to backend in order to get rid of fragile temporary solutions and address known flaws.
Summary of changes/improvements:
librisxl/whelk-core/src/main/groovy/whelk/search2/querytree/FreeText.java
Line 48 in 3613418
FreeText
object now holds a list of tokens instead of simply a string and eachToken
in turn holds valuable information that before was lost in the parsing step. Throughout the whole query machinery we now keep track of whether a token was quoted in the original query string and thus should be treated as a phrase. We also keep track of each token's position (index) in the original query string, which we need for knowing if it's currently being edited, by matching this value against the given cursor position.@jannistsiroyannis I feel that I may have "cheated" with this part so I'd like your input. See changes in
search2.parse
. I just took what I needed for now 😄:Work
). So searching within:contributor
will give suggestions of type:BibliographicAgent
(pending Feature/adjustments for libris search definitions#532) while searching within:title
will give suggestions of type:Work
.:Work
) is complemented with a list of predicates that may be used for adding it as a query criteria (e.g. add a:Person
ascontributor
) and each predicate in the list comes with a full find URL with that criteria added to_q
along with the new expected cursor position after navigating to the URL (we probably need to tweak what the expected position should be). Using a ready-made URL solves the current problem of the raw resource URI being visible for a short moment instead of the "pretty" chip when adding a suggested search criteria.Not really related to the task but some other things that I couldn't help fixing while at it:
In current state these changes require only a small frontend fix (libris/lxlviewer#1328) but more changes will be needed in order to make use of the new suggest functionality. I've started myself to adjust some of the frontend code (libris/lxlviewer#1329). Feel free to take over from there when this one is merged @jesperengstrom @johanbissemattsson.
Once we've switched over to putting input within brackets instead of quotes when searching within property (https://kbse.atlassian.net/browse/LWS-325) we should also revert 70d6482.
I intend to add some more unit tests and clarifying comments.