001
014
015 package com.liferay.portal.kernel.search.suggest;
016
017 import java.util.ArrayList;
018 import java.util.Collections;
019 import java.util.List;
020
021
024 public class SuggesterResult {
025
026 public SuggesterResult(String name) {
027 _name = name;
028 }
029
030 public void addEntry(Entry entry) {
031 _entries.add(entry);
032 }
033
034 public List<Entry> getEntries() {
035 return Collections.unmodifiableList(_entries);
036 }
037
038 public String getName() {
039 return _name;
040 }
041
042 public static class Entry {
043
044 public Entry(String text) {
045 _text = text;
046 }
047
048 public void addOption(Option option) {
049 _options.add(option);
050 }
051
052 public Float getCutoffScore() {
053 return _cutoffScore;
054 }
055
056 public List<Option> getOptions() {
057 return Collections.unmodifiableList(_options);
058 }
059
060 public String getText() {
061 return _text;
062 }
063
064 public void setCutoffScore(Float cutoffScore) {
065 _cutoffScore = cutoffScore;
066 }
067
068 public static class Option {
069
070 public Option(String text, float score) {
071 _text = text;
072 _score = score;
073 }
074
075 public Integer getFrequency() {
076 return _frequency;
077 }
078
079 public String getHighlightedText() {
080 return _highlightedText;
081 }
082
083 public float getScore() {
084 return _score;
085 }
086
087 public String getText() {
088 return _text;
089 }
090
091 public void setFrequency(Integer frequency) {
092 _frequency = frequency;
093 }
094
095 public void setHighlightedText(String highlightedText) {
096 _highlightedText = highlightedText;
097 }
098
099 private Integer _frequency;
100 private String _highlightedText;
101 private final float _score;
102 private String _text;
103
104 }
105
106 private Float _cutoffScore;
107 private final List<Option> _options = new ArrayList<>();
108 private String _text;
109
110 }
111
112 private final List<Entry> _entries = new ArrayList<>();
113 private final String _name;
114
115 }