コード例 #1
0
ファイル: Field.cpp プロジェクト: 304471720/LucenePlusPlus
void Field::ConstructField(const String& name, const String& value, Store store, Index index, TermVector termVector) {
    if (name.empty() && value.empty()) {
        boost::throw_exception(IllegalArgumentException(L"name and value cannot both be empty"));
    }
    if (index == INDEX_NO && store == STORE_NO) {
        boost::throw_exception(IllegalArgumentException(L"it doesn't make sense to have a field that is neither indexed nor stored"));
    }
    if (index == INDEX_NO && termVector != TERM_VECTOR_NO) {
        boost::throw_exception(IllegalArgumentException(L"cannot store term vector information for a field that is not indexed"));
    }

    this->_name = name;
    this->fieldsData = value;
    this->_isStored = isStored(store);
    this->_isIndexed = isIndexed(index);
    this->_isTokenized = isAnalyzed(index);
    this->_omitNorms = omitNorms(index);
    this->_isBinary = false;

    if (index == INDEX_NO) {
        this->omitTermFreqAndPositions = false;
    }

    setStoreTermVector(termVector);
}
コード例 #2
0
ファイル: Field.cpp プロジェクト: 304471720/LucenePlusPlus
void Field::ConstructField(const String& name, const ReaderPtr& reader, TermVector termVector) {
    this->_name = name;
    this->fieldsData = reader;
    this->_isStored = false;
    this->_isIndexed = true;
    this->_isTokenized = true;
    this->_isBinary = false;

    setStoreTermVector(termVector);
}
コード例 #3
0
ファイル: Field.cpp プロジェクト: 304471720/LucenePlusPlus
void Field::ConstructField(const String& name, const TokenStreamPtr& tokenStream, TermVector termVector) {
    this->_name = name;
    this->fieldsData = VariantUtils::null();
    this->tokenStream = tokenStream;
    this->_isStored = false;
    this->_isIndexed = true;
    this->_isTokenized = true;
    this->_isBinary = false;

    setStoreTermVector(termVector);
}
コード例 #4
0
ファイル: Field.cpp プロジェクト: 304471720/LucenePlusPlus
void Field::ConstructField(const String& name, ByteArray value, int32_t offset, int32_t length, Store store) {
    if (store == STORE_NO) {
        boost::throw_exception(IllegalArgumentException(L"binary values can't be unstored"));
    }

    this->_name = name;
    this->fieldsData = value;
    this->_isStored = isStored(store);
    this->_isIndexed = false;
    this->_isTokenized = false;
    this->omitTermFreqAndPositions = false;
    this->_omitNorms = true;
    this->_isBinary = true;
    this->binaryLength = length;
    this->binaryOffset = offset;

    setStoreTermVector(TERM_VECTOR_NO);
}
コード例 #5
0
    AbstractField::AbstractField(const String& name, Field::Store store, Field::Index index, Field::TermVector termVector)
    {
        this->_name = name;
        this->_isStored = Field::isStored(store);
        this->_isIndexed = Field::isIndexed(index);
        this->_isTokenized = Field::isAnalyzed(index);
        this->_omitNorms = Field::omitNorms(index);
        this->_isBinary = false;
        
        this->lazy = false;
        this->omitTermFreqAndPositions = false;
        this->boost = 1.0;
        this->fieldsData = VariantUtils::null();
        
        this->binaryLength = 0;
        this->binaryOffset = 0;

        setStoreTermVector(termVector);
    }