Lucene++ - a full-featured, c++ search engine
API Documentation

Loading...
Searching...
No Matches
Document.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3// Distributable under the terms of either the Apache License (Version 2.0)
4// or the GNU Lesser General Public License.
6
7#ifndef DOCUMENT_H
8#define DOCUMENT_H
9
10#include "LuceneObject.h"
11
12 namespace Lucene {
13
24 class LPPAPI Document : public LuceneObject {
25 public:
27 Document();
28
29 virtual ~Document();
30
31 LUCENE_CLASS(Document);
32
33 protected:
34 Collection<FieldablePtr> fields;
35 double boost;
36
37 public:
47 void setBoost(double boost);
48
58 double getBoost();
59
66 void add(const FieldablePtr& field);
67
75 void removeField(const String& name);
76
83 void removeFields(const String& name);
84
88 FieldPtr getField(const String& name);
89
92 FieldablePtr getFieldable(const String& name);
93
97 String get(const String& name);
98
103 Collection<FieldablePtr> getFields();
104
109 Collection<FieldPtr> getFields(const String& name);
110
115 Collection<FieldablePtr> getFieldables(const String& name);
116
121 Collection<String> getValues(const String& name);
122
127 Collection<ByteArray> getBinaryValues(const String& name);
128
134 ByteArray getBinaryValue(const String& name);
135
137 virtual String toString();
138};
139
140}
141
142#endif
LuceneObject.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::Document
Documents are the unit of indexing and search.
Definition Document.h:24
Lucene::Document::getFieldables
Collection< FieldablePtr > getFieldables(const String &name)
Returns an array of Fieldables with the given name. This method returns an empty array when there are...
Lucene::Document::getBoost
double getBoost()
Returns, at indexing time, the boost factor as set by setBoost(double).
Lucene::Document::toString
virtual String toString()
Returns a string representation of the object.
Lucene::Document::getFields
Collection< FieldablePtr > getFields()
Returns a List of all the fields in a document.
Lucene::Document::getFieldable
FieldablePtr getFieldable(const String &name)
Returns a field with the given name if any exist in this document, or null. If multiple fields exists...
Lucene::Document::getField
FieldPtr getField(const String &name)
Returns a field with the given name if any exist in this document, or null. If multiple fields exists...
Lucene::Document::removeFields
void removeFields(const String &name)
Removes all fields with the given name from the document. If there is no field with the specified nam...
Lucene::Document::boost
double boost
Definition Document.h:35
Lucene::Document::fields
Collection< FieldablePtr > fields
Definition Document.h:34
Lucene::Document::get
String get(const String &name)
Returns the string value of the field with the given name if any exist in this document,...
Lucene::Document::Document
Document()
Constructs a new document with no fields.
Lucene::Document::getFields
Collection< FieldPtr > getFields(const String &name)
Returns an array of Fields with the given name. Do not use with lazy loaded fields....
Lucene::Document::removeField
void removeField(const String &name)
Removes field with the specified name from the document. If multiple fields exist with this name,...
Lucene::Document::setBoost
void setBoost(double boost)
Sets a boost factor for hits on any field of this document. This value will be multiplied into the sc...
Lucene::Document::getBinaryValues
Collection< ByteArray > getBinaryValues(const String &name)
Returns an array of byte arrays for of the fields that have the name specified as the method paramete...
Lucene::Document::getBinaryValue
ByteArray getBinaryValue(const String &name)
Returns an array of bytes for the first (or only) field that has the name specified as the method par...
Lucene::Document::getValues
Collection< String > getValues(const String &name)
Returns an array of values of the field specified as the method parameter. This method returns an emp...
Lucene::Document::~Document
virtual ~Document()
Lucene::Document::add
void add(const FieldablePtr &field)
Adds a field to a document. Several fields may be added with the same name. In this case,...
Lucene::LuceneObject
Base class for all Lucene classes.
Definition LuceneObject.h:31
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::FieldablePtr
boost::shared_ptr< Fieldable > FieldablePtr
Definition LuceneTypes.h:76
Lucene::FieldPtr
boost::shared_ptr< Field > FieldPtr
Definition LuceneTypes.h:75

clucene.sourceforge.net