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