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

Fix lucene query #12100

Merged
merged 10 commits into from
Oct 27, 2024
Merged

Fix lucene query #12100

merged 10 commits into from
Oct 27, 2024

Conversation

LoayGhreeb
Copy link
Collaborator

Follow-up to #11803

  • Fixed search to Lucene conversion.
  • Clear source tab highlighting.
  • Fixed NPE with full-text results tab.
  • Fixed indexing of libraries with long names.

Closes https://github.com/JabRef/jabref-issue-melting-pot/issues/652
Closes https://github.com/JabRef/jabref-issue-melting-pot/issues/655

Mandatory checks

  • I own the copyright of the code submitted and I licence it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

Copy link
Contributor

github-actions bot commented Oct 27, 2024

The build for this PR is no longer available. Please visit https://builds.jabref.org/main/ for the latest build.

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

Looks good.

Since this is kind of hotfix, I just go ahead with merge.

Comment on lines -27 to +26
public static Query searchToLucene(SearchQuery searchQuery) {
public static String searchToLucene(SearchQuery searchQuery) {
Copy link
Member

Choose a reason for hiding this comment

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

We loos strong typing, but I think, the conversion is easier now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, because using the Analyzer here removes words like "a" and "the", which can lead to empty queries with null. This also made testing a bit confusing. For example, if the search term was image, I had to know its stem (imag) for the tests to pass.

Comment on lines -278 to -285
public String getUniqueName() {
if (getDatabasePath().isPresent()) {
Path databasePath = getDatabasePath().get();
return BackupFileUtil.getUniqueFilePrefix(databasePath) + "--" + databasePath.getFileName();
}
return "unsaved" + NUMBER_OF_UNSAVED_LIBRARIES++;
}

Copy link
Member

Choose a reason for hiding this comment

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

That this is removed explains a lot - I missed "my" numbers at untitled - but it is OK IMHO.

The other unique path feature still works:

image

Refs https://github.com/JabRef/jabref-issue-melting-pot/issues/614

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, this method was used only for the Postgres table name, so it is another issue.

@koppor koppor added this pull request to the merge queue Oct 27, 2024
Merged via the queue into main with commit 1bb4e39 Oct 27, 2024
26 of 27 checks passed
@koppor koppor deleted the fix-lucene-query branch October 27, 2024 01:44
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