org.opencms.search.I_CmsSearchDocument Maven / Gradle / Ivy
Show all versions of opencms-test Show documentation
/*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General License for more details.
*
* For further information about Alkacon Software GmbH & Co. KG, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.search;
import org.opencms.relations.CmsCategory;
import org.opencms.search.fields.CmsSearchField;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/**
* The interface for search documents.
*/
public interface I_CmsSearchDocument {
/** Value for "high" search priority. */
String SEARCH_PRIORITY_HIGH_VALUE = "high";
/** Value for "low" search priority. */
String SEARCH_PRIORITY_LOW_VALUE = "low";
/** Value for "maximum" search priority. */
String SEARCH_PRIORITY_MAX_VALUE = "max";
/** Value for "normal" search priority. */
String SEARCH_PRIORITY_NORMAL_VALUE = "normal";
/** The VFS prefix for document keys. */
String VFS_DOCUMENT_KEY_PREFIX = "VFS";
/**
* Adds the list of the given categories to this document.
*
* @param categories the categories to add
*/
void addCategoryField(List categories);
/**
* Adds the given content byte array to this document.
*
* @param content the content to add
*/
void addContentField(byte[] content);
/**
* Adds the locales of the content to this document.
*
* @param locales the locales of the content
*/
void addContentLocales(Collection locales);
/**
* Puts the given date into the field with the given name.
*
* @param name the name to put the date in
* @param date the date to pu into the field
* @param analyzed true
if the inserted value should be analyzable
*/
void addDateField(String name, long date, boolean analyzed);
/**
* Adds the given file size as field to this document.
*
* @param length the length
*/
void addFileSizeField(int length);
/**
* Puts the given path into this document.
*
* @param rootPath the given path into this document
*/
void addPathField(String rootPath);
/**
* Adds the locales of the resource to this document.
*
* @param locales the locales of the resource
*/
void addResourceLocales(Collection locales);
/**
* Puts the given root path into its default field.
*
* @param rootPath the root path to put into the field
*/
void addRootPathField(String rootPath);
/**
* Adds a dynamic search field to the index.
*
* @param field the field
* @param value the value
*/
void addSearchField(CmsSearchField field, String value);
/**
* Adds the suffix field to the document. This field should contain the resource suffix.
*
* Example
* 'html' for a file named 'article.html'
*
* @param suffix the suffix to add
*/
void addSuffixField(String suffix);
/**
* Adds the resource type to this document.
* @param paramString
*/
void addTypeField(String paramString);
/**
* Returns the content blob of this document.
*
* @return the content blob
*/
byte[] getContentBlob();
/**
* Returns the concrete document as Object to be cast if necessary.
*
* @return the document as Object
*/
Object getDocument();
/**
* Returns all field names of this document.
*
* @return the field names
*/
List getFieldNames();
/**
* Tries to return the value of the field for the given name as Date,
* null
if the field is empty or if the field is not of the type date.
*
* @param fieldName the name of the field to get the Date value for
*
* @return the date or null
*/
Date getFieldValueAsDate(String fieldName);
/**
* Returns the value of the field for the given name as String.
*
* @param fieldName the name of the field to get the String value for
*
* @return the String value or null
if empty
*/
String getFieldValueAsString(String fieldName);
/**
* Returns a list of Strings representing the values of an multi valued field.
*
* @param fieldName the name of the multi valued field to get the content of
*
* @return the list of Strings, or null
*/
List getMultivaluedFieldAsStringList(String fieldName);
/**
* Returns the root path of the referenced VFS resource of this document.
*
* @return the root path
*/
String getPath();
/**
* Returns the score for this document.
*
* @return the score
*/
float getScore();
/**
* Returns the resource type of the referenced VFS resource of this document.
*
* @return the type
*/
String getType();
/**
* Sets the boost factor for the whole document.
*
* @param boost the factor to set
*/
void setBoost(float boost);
/**
* Sets the score for this document.
*
* @param score the score
*/
void setScore(float score);
}