1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.kernel.search;
21  
22  /**
23   * <a href="Field.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Bruno Farache
26   * @author Brian Wing Shun Chan
27   * @author Allen Chiang
28   * @author Alex Wallace
29   *
30   */
31  public class Field {
32  
33      public static final String COMMENTS = "comments";
34  
35      public static final String COMPANY_ID = "companyId";
36  
37      public static final String CONTENT = "content";
38  
39      public static final String DESCRIPTION = "description";
40  
41      public static final String ENTRY_CLASS_NAME = "entryClassName";
42  
43      public static final String ENTRY_CLASS_PK = "entryClassPK";
44  
45      public static final String GROUP_ID = "groupId";
46  
47      public static final String MODIFIED = "modified";
48  
49      public static final String NAME = "name";
50  
51      public static final String PORTLET_ID = "portletId";
52  
53      public static final String PROPERTIES = "properties";
54  
55      public static final String TAGS_ENTRIES = "tagsEntries";
56  
57      public static final String TITLE = "title";
58  
59      public static final String TYPE = "type";
60  
61      public static final String UID = "uid";
62  
63      public static final String URL = "url";
64  
65      public static final String USER_ID = "userId";
66  
67      public static final String USER_NAME = "userName";
68  
69      public static final String VERSION = "version";
70  
71      public Field(String name, String value, boolean tokenized) {
72          this(name, new String[] {value}, tokenized);
73      }
74  
75      public Field(String name, String[] values, boolean tokenized) {
76          this(name, values, tokenized, 1);
77      }
78  
79      public Field(String name, String[] values, boolean tokenized, float boost) {
80          _name = name;
81          _values = values;
82          _tokenized = tokenized;
83          _boost = boost;
84      }
85  
86      public float getBoost() {
87          return _boost;
88      }
89  
90      public String getName() {
91          return _name;
92      }
93  
94      public String getValue() {
95          if ((_values != null) && (_values.length > 0)) {
96              return _values[0];
97          }
98          else {
99              return null;
100         }
101     }
102 
103     public String[] getValues() {
104         return _values;
105     }
106 
107     public boolean isTokenized() {
108         return _tokenized;
109     }
110 
111     public void setBoost(float boost) {
112         _boost = boost;
113     }
114 
115     public void setName(String name) {
116         _name = name;
117     }
118 
119     public void setTokenized(boolean type) {
120         _tokenized = type;
121     }
122 
123     public void setValue(String value) {
124         setValues(new String[] {value});
125     }
126 
127     public void setValues(String[] values) {
128         _values = values;
129     }
130 
131     private float _boost;
132     private String _name;
133     private boolean _tokenized;
134     private String[] _values;
135 
136 }