This is an automated email from the ASF dual-hosted git repository.
airborne pushed a commit to branch clucene-3.0
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git
The following commit(s) were added to refs/heads/clucene-3.0 by this push:
new 14c0a532863 [opt](index writer) allow non analyzer for non-tokenize
flag (#342) (#343)
14c0a532863 is described below
commit 14c0a532863d39ac11778efe01b76993f0696a71
Author: airborne12 <[email protected]>
AuthorDate: Tue Jul 29 00:22:10 2025 +0800
[opt](index writer) allow non analyzer for non-tokenize flag (#342) (#343)
---
src/core/CLucene/index/IndexWriter.cpp | 2 +-
src/core/CLucene/index/SDocumentWriter.cpp | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/core/CLucene/index/IndexWriter.cpp
b/src/core/CLucene/index/IndexWriter.cpp
index c26e5c68cb6..3e041f84568 100644
--- a/src/core/CLucene/index/IndexWriter.cpp
+++ b/src/core/CLucene/index/IndexWriter.cpp
@@ -297,7 +297,7 @@ void IndexWriter::init(Directory *d, Analyzer *a, const
bool create, const bool
_CLTHROWA(CL_ERR_IllegalArgument, "IndexWriter::init: Only
support SDocumentsWriter");
}
} else {
- _CLTHROWA(CL_ERR_IllegalArgument, "IndexWriter::init: Only support
SDocumentsWriter");
+ docWriter = _CLNEW SDocumentsWriter<char>(directory, this);
}
pushMaxBufferedDocs();
diff --git a/src/core/CLucene/index/SDocumentWriter.cpp
b/src/core/CLucene/index/SDocumentWriter.cpp
index 17202cada5e..4687af5f730 100644
--- a/src/core/CLucene/index/SDocumentWriter.cpp
+++ b/src/core/CLucene/index/SDocumentWriter.cpp
@@ -630,10 +630,6 @@ void
SDocumentsWriter<T>::ThreadState::FieldData::addPosition(Token *token) {
template<typename T>
void SDocumentsWriter<T>::ThreadState::FieldData::invertField(Field *field,
Analyzer *sanalyzer, const int32_t maxFieldLength) {
-
- if (length > 0)
- position += sanalyzer->getPositionIncrementGap(fieldInfo->name);
-
if (!field->isTokenized()) {// un-tokenized field
const T *stringValue = (T *) field->rawStringValue();
const size_t valueLength = field->getFieldDataLength();
@@ -647,6 +643,9 @@ void
SDocumentsWriter<T>::ThreadState::FieldData::invertField(Field *field, Anal
offset += valueLength;
length++;
} else {// tokenized field
+ if (length > 0) {
+ position += sanalyzer->getPositionIncrementGap(fieldInfo->name);
+ }
TokenStream *stream;
TokenStream *streamValue = field->tokenStreamValue();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]