001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.search;
016    
017    import java.io.Serializable;
018    
019    /**
020     * @author Bruno Farache
021     * @author Brian Wing Shun Chan
022     * @author Allen Chiang
023     * @author Alex Wallace
024     */
025    public class Field implements Serializable {
026    
027            public static final String ASSET_CATEGORY_IDS = "assetCategoryIds";
028    
029            public static final String ASSET_CATEGORY_NAMES = "assetCategoryNames";
030    
031            public static final String ASSET_TAG_NAMES = "assetTagNames";
032    
033            public static final String CATEGORY_ID = "categoryId";
034    
035            public static final String COMMENTS = "comments";
036    
037            public static final String COMPANY_ID = "companyId";
038    
039            public static final String CONTENT = "content";
040    
041            public static final String DESCRIPTION = "description";
042    
043            public static final String ENTRY_CLASS_NAME = "entryClassName";
044    
045            public static final String ENTRY_CLASS_PK = "entryClassPK";
046    
047            public static final String FOLDER_ID = "folderId";
048    
049            public static final String GROUP_ID = "groupId";
050    
051            public static final String GROUP_ROLE_ID = "groupRoleId";
052    
053            public static final String MODIFIED = "modified";
054    
055            public static final String NAME = "name";
056    
057            public static final String NODE_ID = "nodeId";
058    
059            public static final String ORGANIZATION_ID = "organzationId";
060    
061            public static final String PORTLET_ID = "portletId";
062    
063            public static final String PROPERTIES = "properties";
064    
065            public static final String ROLE_ID = "roleId";
066    
067            public static final String ROOT_ENTRY_CLASS_PK = "rootEntryClassPK";
068    
069            public static final String SCOPE_GROUP_ID = "scopeGroupId";
070    
071            public static final String TITLE = "title";
072    
073            public static final String TYPE = "type";
074    
075            public static final String UID = "uid";
076    
077            public static final String URL = "url";
078    
079            public static final String USER_ID = "userId";
080    
081            public static final String USER_NAME = "userName";
082    
083            public static final String VERSION = "version";
084    
085            public Field(String name, String value, boolean tokenized) {
086                    this(name, new String[] {value}, tokenized);
087            }
088    
089            public Field(String name, String[] values, boolean tokenized) {
090                    this(name, values, tokenized, 1);
091            }
092    
093            public Field(String name, String[] values, boolean tokenized, float boost) {
094                    _name = name;
095                    _values = values;
096                    _tokenized = tokenized;
097                    _boost = boost;
098            }
099    
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    }