Skip to content

Conversation

gaborbernat
Copy link

@gaborbernat gaborbernat commented Oct 2, 2025

Fixes #4740

Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Oct 2, 2025
@QueryParam("projects") final List<String> projects,
@QueryParam("maxresults") // Akin to QueryParameters.COUNT_PARAM
@DefaultValue(MAX_RESULTS + "") final int maxResults,
@QueryParam(QueryParameters.SORT_PARAM) @DefaultValue("relevancy") final String sort,
Copy link
Member

Choose a reason for hiding this comment

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

use SortOrder.RELEVANCY.toString() instead of the hard-coded string literal.

Copy link
Member

Choose a reason for hiding this comment

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

Also, the Javadoc in IncomingFilter needs to be updated for the changed method signature.

Copy link
Author

Choose a reason for hiding this comment

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

Cannot use SortOrder.RELEVANCY.toString() directly in the @DefaultValue annotation, because Java requires annotation values to be compile-time constants.

@vladak
Copy link
Member

vladak commented Oct 14, 2025

The Apirary documentation in the apiary.apib file needs update for the /search endpoint.

Comment on lines 217 to +236
searcher.search(query, collector);
totalHits = collector.getTotalHits();
stat.report(LOGGER, Level.FINEST, "search via SearchEngine done",
"search.latency", new String[]{"category", "engine",
"outcome", totalHits > 0 ? "success" : "empty"});
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if such pieces could be refactored to avoid code duplication.

@vladak
Copy link
Member

vladak commented Oct 14, 2025

Also, needs a test case.

hits = collector.topDocs().scoreDocs;
} else {
// Field based sort; use TopFieldCollector
TopFieldCollector fieldCollector = TopFieldCollector.create(luceneSort, hitsPerPage * cachePages, Short.MAX_VALUE);
Copy link
Member

@vladak vladak Oct 14, 2025

Choose a reason for hiding this comment

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

How does this work w.r.t. the private TopScoreDocCollector collector; on line 135/143 ? In the luceneSort == null branch the private member is assigned however here local variable is used.

What about the results() function which uses this member ?

@vladak
Copy link
Member

vladak commented Oct 14, 2025

Just a note: this conflicts with the changes done for Lucene 9.x update in PR #4867. It looks like this can be reconciled easily, though.

@gaborbernat
Copy link
Author

I signed the OCA on Friday any idea when it will be approved?

@gaborbernat gaborbernat force-pushed the 4740-feat branch 3 times, most recently from a33b595 to cb9fd70 Compare October 15, 2025 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search API allow sort by path

2 participants