use of io.jmix.search.searching.SearchContext in project jmix by jmix-framework.
the class SearchFieldImpl method performSearch.
public void performSearch() {
Screen frameOwner = ComponentsHelper.getWindowNN(this).getFrameOwner();
String searchText = getValue();
ScreenContext screenContext = getScreenContext(frameOwner);
if (StringUtils.isBlank(searchText)) {
Notifications notifications = screenContext.getNotifications();
notifications.create(HUMANIZED).withCaption(messages.getMessage("io.jmix.searchui.noSearchText")).show();
} else {
String preparedSearchText = searchText.trim();
SearchContext searchContext = new SearchContext(preparedSearchText).setSize(searchProperties.getSearchResultPageSize()).setEntities(getEntities());
SearchResult searchResult = entitySearcher.search(searchContext, searchStrategy);
if (searchCompletedHandler != null) {
searchCompletedHandler.accept(new SearchCompletedEvent(this, searchResult));
}
}
}
use of io.jmix.search.searching.SearchContext in project jmix-docs by Haulmont.
the class UsingApiScreen method onSearchBtnClick.
// end::search-result-processor[]
// tag::click-event[]
// <1>
@Subscribe("searchBtn")
public void onSearchBtnClick(Button.ClickEvent event) {
SearchContext searchContext = new SearchContext("silver").setSize(10).setEntities(// <2>
"search_Order");
// <3>
SearchResult searchResult = entitySearcher.search(searchContext);
Collection<Object> instances = // <4>
searchResultProcessor.loadEntityInstances(searchResult);
// ...
}
Aggregations