1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.search;
24  
25  import java.io.Serializable;
26  
27  /**
28   * <a href="Field.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Bruno Farache
31   * @author Brian Wing Shun Chan
32   * @author Allen Chiang
33   * @author Alex Wallace
34   */
35  public class Field implements Serializable {
36  
37      public static final String COMMENTS = "comments";
38  
39      public static final String COMPANY_ID = "companyId";
40  
41      public static final String CONTENT = "content";
42  
43      public static final String DESCRIPTION = "description";
44  
45      public static final String ENTRY_CLASS_NAME = "entryClassName";
46  
47      public static final String ENTRY_CLASS_PK = "entryClassPK";
48  
49      public static final String GROUP_ID = "groupId";
50  
51      public static final String GROUP_ROLE_ID = "groupRoleId";
52  
53      public static final String MODIFIED = "modified";
54  
55      public static final String NAME = "name";
56  
57      public static final String PORTLET_ID = "portletId";
58  
59      public static final String PROPERTIES = "properties";
60  
61      public static final String ROLE_ID = "roleId";
62  
63      public static final String ROOT_ENTRY_CLASS_PK = "rootEntryClassPK";
64  
65      public static final String SCOPE_GROUP_ID = "scopeGroupId";
66  
67      public static final String TAGS_CATEGORIES = "tagsCategories";
68  
69      public static final String TAGS_ENTRIES = "tagsEntries";
70  
71      public static final String TITLE = "title";
72  
73      public static final String TYPE = "type";
74  
75      public static final String UID = "uid";
76  
77      public static final String URL = "url";
78  
79      public static final String USER_ID = "userId";
80  
81      public static final String USER_NAME = "userName";
82  
83      public static final String VERSION = "version";
84  
85      public Field(String name, String value, boolean tokenized) {
86          this(name, new String[] {value}, tokenized);
87      }
88  
89      public Field(String name, String[] values, boolean tokenized) {
90          this(name, values, tokenized, 1);
91      }
92  
93      public Field(String name, String[] values, boolean tokenized, float boost) {
94          _name = name;
95          _values = values;
96          _tokenized = tokenized;
97          _boost = boost;
98      }
99  
100     public float getBoost() {
101         return _boost;
102     }
103 
104     public String getName() {
105         return _name;
106     }
107 
108     public String getValue() {
109         if ((_values != null) && (_values.length > 0)) {
110             return _values[0];
111         }
112         else {
113             return null;
114         }
115     }
116 
117     public String[] getValues() {
118         return _values;
119     }
120 
121     public boolean isTokenized() {
122         return _tokenized;
123     }
124 
125     public void setBoost(float boost) {
126         _boost = boost;
127     }
128 
129     public void setName(String name) {
130         _name = name;
131     }
132 
133     public void setTokenized(boolean type) {
134         _tokenized = type;
135     }
136 
137     public void setValue(String value) {
138         setValues(new String[] {value});
139     }
140 
141     public void setValues(String[] values) {
142         _values = values;
143     }
144 
145     private float _boost;
146     private String _name;
147     private boolean _tokenized;
148     private String[] _values;
149 
150 }