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 MODIFIED = "modified";
44  
45      public static final String NAME = "name";
46  
47      public static final String PORTLET_ID = "portletId";
48  
49      public static final String PROPERTIES = "properties";
50  
51      public static final String TAGS_ENTRIES = "tagsEntries";
52  
53      public static final String TITLE = "title";
54  
55      public static final String TYPE = "type";
56  
57      public static final String UID = "uid";
58  
59      public static final String URL = "url";
60  
61      public static final String USER_ID = "userId";
62  
63      public static final String USER_NAME = "userName";
64  
65      public static final String VERSION = "version";
66  
67      public Field(String name, String value, boolean tokenized) {
68          this(name, new String[] {value}, tokenized);
69      }
70  
71      public Field(String name, String[] values, boolean tokenized) {
72          this(name, values, tokenized, 1);
73      }
74  
75      public Field(String name, String[] values, boolean tokenized, float boost) {
76          _name = name;
77          _values = values;
78          _tokenized = tokenized;
79          _boost = boost;
80      }
81  
82      public float getBoost() {
83          return _boost;
84      }
85  
86      public String getName() {
87          return _name;
88      }
89  
90      public String getValue() {
91          if ((_values != null) && (_values.length > 0)) {
92              return _values[0];
93          }
94          else {
95              return null;
96          }
97      }
98  
99      public String[] getValues() {
100         return _values;
101     }
102 
103     public boolean isTokenized() {
104         return _tokenized;
105     }
106 
107     public void setBoost(float boost) {
108         _boost = boost;
109     }
110 
111     public void setName(String name) {
112         _name = name;
113     }
114 
115     public void setTokenized(boolean type) {
116         _tokenized = type;
117     }
118 
119     public void setValue(String value) {
120         setValues(new String[] {value});
121     }
122 
123     public void setValues(String[] values) {
124         _values = values;
125     }
126 
127     private float _boost;
128     private String _name;
129     private boolean _tokenized;
130     private String[] _values;
131 
132 }