|
|
|
@ -13,6 +13,7 @@ import javax.inject.Named; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
import com.mousetech.gourmetj.persistence.model.Recipe; |
|
|
|
@ -95,6 +96,30 @@ public class AdminMainBean implements Serializable { |
|
|
|
|
userSession.setLastSearch(searchText); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<String> suggestionList = null; |
|
|
|
|
|
|
|
|
|
public void resetSuggestions() { |
|
|
|
|
suggestionList = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<String> searchSuggestionList(String query) { |
|
|
|
|
if (suggestionList == null) { |
|
|
|
|
switch (this.userSession.getSearchType()) { |
|
|
|
|
case rst_BY_CATEGORY: |
|
|
|
|
suggestionList = |
|
|
|
|
recipeService.findCategories(); |
|
|
|
|
break; |
|
|
|
|
case rst_BY_CUISINE: |
|
|
|
|
suggestionList = |
|
|
|
|
recipeService.findCuisines(); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
suggestionList = new ArrayList<String>(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return suggestionList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**/ |
|
|
|
|
transient DataModel<Recipe> searchResults; |
|
|
|
|
|
|
|
|
|