Skip to content

Commit

Permalink
Merge pull request #2078 from scireum/ili/open-search-html
Browse files Browse the repository at this point in the history
Show HTML formatted job descriptions in OpenSearch
  • Loading branch information
idlira authored Jan 17, 2025
2 parents 43bd4b8 + ac4d7e8 commit adc0380
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/sirius/biz/jobs/JobsSearchProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void query(String query, int maxResults, Consumer<OpenSearchResult> resul
jobs.getAvailableJobs(query).filter(JobFactory::canStartInteractive).forEach(jobFactory -> {
OpenSearchResult result = new OpenSearchResult();
result.withLabel(jobFactory.getLabel())
.withDescription(jobFactory.getDescription())
.withHtmlDescription(jobFactory.getDescription())
.withURL("/job/" + jobFactory.getName());
resultCollector.accept(result);
});
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/sirius/biz/tycho/search/OpenSearchResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,18 @@ public OpenSearchResult withURL(String url) {
* @return the result itself for fluent method calls.
*/
public OpenSearchResult withDescription(String description) {
this.htmlDescription = Strings.cleanup(description, StringCleanup::escapeXml);
withHtmlDescription(Strings.cleanup(description, StringCleanup::escapeXml));
return this;
}

/**
* Provides an additional HTML description to show.
*
* @param htmlDescription the description of this result, expected to contain HTML.
* @return the result itself for fluent method calls.
*/
public OpenSearchResult withHtmlDescription(String htmlDescription) {
this.htmlDescription = htmlDescription;
return this;
}

Expand Down

0 comments on commit adc0380

Please sign in to comment.