Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
eaf52ec4
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eaf52ec4
编写于
11月 18, 2022
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
multi value
上级
284ee016
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
659 addition
and
341 deletion
+659
-341
o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_query_service_processing.java
...a/com/x/base/core/project/x_query_service_processing.java
+1
-0
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/index/ActionExport.java
...om/x/query/assemble/surface/jaxrs/index/ActionExport.java
+1
-1
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/index/ActionPost.java
.../com/x/query/assemble/surface/jaxrs/index/ActionPost.java
+3
-3
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/index/BaseAction.java
.../com/x/query/assemble/surface/jaxrs/index/BaseAction.java
+247
-72
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/morelikethis/ActionPost.java
...query/assemble/surface/jaxrs/morelikethis/ActionPost.java
+9
-9
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/morelikethis/BaseAction.java
...query/assemble/surface/jaxrs/morelikethis/BaseAction.java
+0
-1
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/morelikethis/MoreLikeThisAction.java
...semble/surface/jaxrs/morelikethis/MoreLikeThisAction.java
+0
-1
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/search/ActionTest.java
...com/x/query/assemble/surface/jaxrs/search/ActionTest.java
+0
-11
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/statement/ActionExecuteV2.java
...ery/assemble/surface/jaxrs/statement/ActionExecuteV2.java
+0
-1
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/view/BaseAction.java
...a/com/x/query/assemble/surface/jaxrs/view/BaseAction.java
+5
-2
o2server/x_query_core_express/src/main/java/com/x/query/core/express/index/Filter.java
.../src/main/java/com/x/query/core/express/index/Filter.java
+29
-29
o2server/x_query_core_express/src/main/java/com/x/query/core/express/index/Indexs.java
.../src/main/java/com/x/query/core/express/index/Indexs.java
+189
-21
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/index/Doc.java
...c/main/java/com/x/query/service/processing/index/Doc.java
+96
-151
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/index/DocFunction.java
...ava/com/x/query/service/processing/index/DocFunction.java
+79
-39
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_query_service_processing.java
浏览文件 @
eaf52ec4
...
...
@@ -14,6 +14,7 @@ import com.x.base.core.project.annotation.ModuleType;
"com.x.query.core.entity.neural.OutValue"
,
"com.x.query.core.entity.neural.Model"
,
"com.x.query.core.entity.schema.*"
,
"com.x.query.core.entity.index.State"
,
"com.x.processplatform.core.entity.content.Review"
,
"com.x.processplatform.core.entity.content.Task"
,
"com.x.processplatform.core.entity.element.Process"
,
"com.x.processplatform.core.entity.element.Application"
,
"com.x.query.core.entity.ImportModel"
,
"com.x.processplatform.core.entity.content.Work"
,
...
...
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/index/ActionExport.java
浏览文件 @
eaf52ec4
...
...
@@ -196,7 +196,7 @@ class ActionExport extends BaseAction {
final
Row
row
=
param
.
third
().
createRow
(
param
.
third
().
getLastRowNum
()
+
1
);
Streams
.
mapWithIndex
(
param
.
first
().
stream
(),
Pair:
:
of
)
.
map
(
o
->
Quintuple
.
of
(
o
.
first
().
first
(),
o
.
first
().
second
(),
o
.
first
().
third
(),
o
.
second
(),
param
.
second
().
getField
(
o
.
first
().
first
())))
param
.
second
().
getField
s
(
o
.
first
().
first
())))
.
filter
(
o
->
!
Objects
.
isNull
(
o
.
fifth
())).
forEach
(
o
->
{
Object
value
=
Indexs
.
indexableFieldValue
(
o
.
fifth
(),
o
.
third
());
Cell
cell
=
row
.
createCell
(
o
.
fourth
().
intValue
());
...
...
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/index/ActionPost.java
浏览文件 @
eaf52ec4
...
...
@@ -99,7 +99,7 @@ class ActionPost extends BaseAction {
}
try
(
MultiReader
multiReader
=
new
MultiReader
(
indexReaders
))
{
IndexSearcher
searcher
=
new
IndexSearcher
(
multiReader
);
wo
.
setDynamicFieldList
(
getDynamicFieldList
(
multiReader
));
wo
.
setDynamicFieldList
(
getDynamicFieldList
(
categories
,
multiReader
));
TopFieldCollector
topFieldCollector
=
TopFieldCollector
.
create
(
sort
(
wi
.
getSort
()),
1000
,
1000
);
List
<
Pair
<
String
,
FirstPassGroupingCollector
<
BytesRef
>>>
firstPassGroupingCollectorPairs
=
this
.
adjustFacetField
(
categories
,
...
...
@@ -170,8 +170,8 @@ class ActionPost extends BaseAction {
try
{
org
.
apache
.
lucene
.
document
.
Document
document
=
searcher
.
doc
(
o
.
doc
);
Map
<
String
,
Object
>
map
=
outFields
.
stream
()
.
map
(
f
->
Quadruple
.
of
(
Indexs
.
judgeField
(
f
),
document
.
getField
(
f
)))
.
filter
(
param
->
null
!=
param
.
fourth
()
)
.
map
(
f
->
Quadruple
.
of
(
Indexs
.
judgeField
(
f
),
document
.
getField
s
(
f
)))
.
filter
(
param
->
param
.
fourth
().
length
>
0
)
.
map
(
p
->
Pair
.
of
(
p
.
first
(),
Indexs
.
indexableFieldValue
(
p
.
fourth
(),
p
.
third
())))
.
collect
(
Collectors
.
toMap
(
Pair:
:
first
,
Pair:
:
second
));
wo
.
getDocumentList
().
add
(
map
);
...
...
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/index/BaseAction.java
浏览文件 @
eaf52ec4
此差异已折叠。
点击以展开。
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/morelikethis/ActionPost.java
浏览文件 @
eaf52ec4
...
...
@@ -102,31 +102,31 @@ class ActionPost extends BaseAction {
org
.
apache
.
lucene
.
document
.
Document
document
=
reader
.
document
(
scoreDoc
.
doc
);
ActionPostWo
.
WoMoreLikeThis
woMoreLikeThis
=
new
ActionPostWo
.
WoMoreLikeThis
();
woMoreLikeThis
.
setTitle
(
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
(
Indexs
.
FIELD_TITLE
),
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
s
(
Indexs
.
FIELD_TITLE
),
Indexs
.
FIELD_TYPE_STRING
));
woMoreLikeThis
.
setFlag
(
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
(
Indexs
.
FIELD_ID
),
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
s
(
Indexs
.
FIELD_ID
),
Indexs
.
FIELD_TYPE_STRING
));
woMoreLikeThis
.
setCategory
(
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
(
Indexs
.
FIELD_CATEGORY
),
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
s
(
Indexs
.
FIELD_CATEGORY
),
Indexs
.
FIELD_TYPE_STRING
));
woMoreLikeThis
.
setType
(
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
(
Indexs
.
FIELD_TYPE
),
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
s
(
Indexs
.
FIELD_TYPE
),
Indexs
.
FIELD_TYPE_STRING
));
woMoreLikeThis
.
setKey
(
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
(
Indexs
.
FIELD_KEY
),
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
s
(
Indexs
.
FIELD_KEY
),
Indexs
.
FIELD_TYPE_STRING
));
woMoreLikeThis
.
setCreateTime
(
Indexs
.<
Date
>
indexableFieldValue
(
document
.
getField
(
Indexs
.
FIELD_CREATETIME
),
Indexs
.<
Date
>
indexableFieldValue
(
document
.
getField
s
(
Indexs
.
FIELD_CREATETIME
),
Indexs
.
FIELD_TYPE_DATE
));
woMoreLikeThis
.
setUpdateTime
(
Indexs
.<
Date
>
indexableFieldValue
(
document
.
getField
(
Indexs
.
FIELD_UPDATETIME
),
Indexs
.<
Date
>
indexableFieldValue
(
document
.
getField
s
(
Indexs
.
FIELD_UPDATETIME
),
Indexs
.
FIELD_TYPE_DATE
));
woMoreLikeThis
.
setCreatorPerson
(
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
(
Indexs
.
FIELD_CREATORPERSON
),
document
.
getField
s
(
Indexs
.
FIELD_CREATORPERSON
),
Indexs
.
FIELD_TYPE_STRING
));
woMoreLikeThis
.
setCreatorUnit
(
Indexs
.<
String
>
indexableFieldValue
(
document
.
getField
(
Indexs
.
FIELD_CREATORUNIT
),
document
.
getField
s
(
Indexs
.
FIELD_CREATORUNIT
),
Indexs
.
FIELD_TYPE_STRING
));
woMoreLikeThis
.
setKey
(
document
.
get
(
Indexs
.
FIELD_KEY
));
woMoreLikeThis
.
setScore
(
scoreDoc
.
score
);
...
...
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/morelikethis/BaseAction.java
浏览文件 @
eaf52ec4
...
...
@@ -6,7 +6,6 @@ import java.util.Optional;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.lucene.index.Term
;
import
org.apache.lucene.queryparser.classic.ParseException
;
import
org.apache.lucene.search.Query
;
import
org.apache.lucene.search.TermQuery
;
...
...
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/morelikethis/MoreLikeThisAction.java
浏览文件 @
eaf52ec4
...
...
@@ -22,7 +22,6 @@ import com.x.base.core.project.logger.Logger;
import
com.x.base.core.project.logger.LoggerFactory
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.media.ArraySchema
;
import
io.swagger.v3.oas.annotations.media.Content
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.parameters.RequestBody
;
...
...
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/search/ActionTest.java
浏览文件 @
eaf52ec4
package
com.x.query.assemble.surface.jaxrs.search
;
import
java.util.Optional
;
import
org.apache.lucene.index.DirectoryReader
;
import
org.apache.lucene.index.IndexReader
;
import
org.apache.lucene.index.LeafReaderContext
;
import
org.apache.lucene.index.Terms
;
import
org.apache.lucene.index.TermsEnum
;
import
org.apache.lucene.store.Directory
;
import
org.apache.lucene.util.BytesRef
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapString
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.query.core.express.index.Indexs
;
class
ActionTest
extends
BaseAction
{
...
...
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/statement/ActionExecuteV2.java
浏览文件 @
eaf52ec4
...
...
@@ -13,7 +13,6 @@ import javax.script.Bindings;
import
javax.script.CompiledScript
;
import
javax.script.ScriptContext
;
import
com.x.base.core.project.tools.StringTools
;
import
org.apache.commons.collections4.list.TreeList
;
import
org.apache.commons.lang3.StringUtils
;
...
...
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/view/BaseAction.java
浏览文件 @
eaf52ec4
...
...
@@ -2,10 +2,13 @@ package com.x.query.assemble.surface.jaxrs.view;
import
java.io.ByteArrayOutputStream
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.concurrent.ExecutorService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
...
...
o2server/x_query_core_express/src/main/java/com/x/query/core/express/index/Filter.java
浏览文件 @
eaf52ec4
...
...
@@ -9,46 +9,46 @@ import io.swagger.v3.oas.annotations.media.Schema;
@Schema
(
name
=
"com.x.query.core.express.index.Filter"
)
public
class
Filter
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
8404002412785606829L
;
private
static
final
long
serialVersionUID
=
8404002412785606829L
;
String
field
;
String
field
;
List
<
String
>
valueList
;
List
<
String
>
valueList
;
String
start
;
String
min
;
String
end
;
String
max
;
public
String
getField
()
{
return
field
;
}
public
String
getField
()
{
return
field
;
}
public
void
setField
(
String
field
)
{
this
.
field
=
field
;
}
public
void
setField
(
String
field
)
{
this
.
field
=
field
;
}
public
List
<
String
>
getValueList
()
{
return
valueList
;
}
public
List
<
String
>
getValueList
()
{
return
valueList
;
}
public
void
setValueList
(
List
<
String
>
valueList
)
{
this
.
valueList
=
valueList
;
}
public
void
setValueList
(
List
<
String
>
valueList
)
{
this
.
valueList
=
valueList
;
}
public
String
getStart
()
{
return
start
;
}
public
String
getMin
()
{
return
min
;
}
public
void
setStart
(
String
start
)
{
this
.
start
=
start
;
}
public
void
setMin
(
String
min
)
{
this
.
min
=
min
;
}
public
String
getEnd
()
{
return
end
;
}
public
String
getMax
()
{
return
max
;
}
public
void
setEnd
(
String
end
)
{
this
.
end
=
end
;
}
public
void
setMax
(
String
max
)
{
this
.
max
=
max
;
}
}
o2server/x_query_core_express/src/main/java/com/x/query/core/express/index/Indexs.java
浏览文件 @
eaf52ec4
...
...
@@ -11,15 +11,17 @@ import java.util.Arrays;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.apache.hadoop.fs.CommonConfigurationKeysPublic
;
import
org.apache.hadoop.fs.LocatedFileStatus
;
import
org.apache.hadoop.fs.RemoteIterator
;
import
org.apache.lucene.document.LongPoint
;
import
org.apache.lucene.index.IndexableField
;
import
org.apache.lucene.index.Term
;
import
org.apache.lucene.search.BooleanClause
;
...
...
@@ -35,6 +37,7 @@ import com.x.base.core.project.config.Config;
import
com.x.base.core.project.config.Query
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.tools.NumberTools
;
...
...
@@ -130,6 +133,37 @@ public class Indexs {
public
static
final
String
PREFIX_FIELD_DATA_DATE
=
PREFIX_FIELD_DATA
+
FIELD_TYPE_DATE
+
"_"
;
public
static
final
String
PREFIX_FIELD_DATA_DATES
=
PREFIX_FIELD_DATA
+
FIELD_TYPE_DATES
+
"_"
;
public
static
final
String
PREFIX_FIELD_PROCESSPLATFORM
=
"processPlatform_"
;
public
static
final
String
FIELD_ROCESSPLATFORM_TASKPERSONNAMES
=
"taskPersonNames"
;
public
static
final
String
FIELD_ROCESSPLATFORM_PRETASKPERSONNAMES
=
"preTaskPersonNames"
;
public
static
final
String
PREFIX_FIELD_PROCESSPLATFORM_STRING
=
PREFIX_FIELD_PROCESSPLATFORM
+
FIELD_TYPE_STRING
+
"_"
;
public
static
final
String
PREFIX_FIELD_PROCESSPLATFORM_STRINGS
=
PREFIX_FIELD_PROCESSPLATFORM
+
FIELD_TYPE_STRINGS
+
"_"
;
public
static
final
String
PREFIX_FIELD_PROCESSPLATFORM_BOOLEAN
=
PREFIX_FIELD_PROCESSPLATFORM
+
FIELD_TYPE_BOOLEAN
+
"_"
;
public
static
final
String
PREFIX_FIELD_PROCESSPLATFORM_BOOLEANS
=
PREFIX_FIELD_PROCESSPLATFORM
+
FIELD_TYPE_BOOLEANS
+
"_"
;
public
static
final
String
PREFIX_FIELD_PROCESSPLATFORM_NUMBER
=
PREFIX_FIELD_PROCESSPLATFORM
+
FIELD_TYPE_NUMBER
+
"_"
;
public
static
final
String
PREFIX_FIELD_PROCESSPLATFORM_NUMBERS
=
PREFIX_FIELD_PROCESSPLATFORM
+
FIELD_TYPE_NUMBERS
+
"_"
;
public
static
final
String
PREFIX_FIELD_PROCESSPLATFORM_DATE
=
PREFIX_FIELD_PROCESSPLATFORM
+
FIELD_TYPE_DATE
+
"_"
;
public
static
final
String
PREFIX_FIELD_PROCESSPLATFORM_DATES
=
PREFIX_FIELD_PROCESSPLATFORM
+
FIELD_TYPE_DATES
+
"_"
;
public
static
final
String
PREFIX_FIELD_CMS
=
"cms_"
;
public
static
final
String
PREFIX_FIELD_CMS_STRING
=
PREFIX_FIELD_CMS
+
FIELD_TYPE_STRING
+
"_"
;
public
static
final
String
PREFIX_FIELD_CMS_STRINGS
=
PREFIX_FIELD_CMS
+
FIELD_TYPE_STRINGS
+
"_"
;
public
static
final
String
PREFIX_FIELD_CMS_BOOLEAN
=
PREFIX_FIELD_CMS
+
FIELD_TYPE_BOOLEAN
+
"_"
;
public
static
final
String
PREFIX_FIELD_CMS_BOOLEANS
=
PREFIX_FIELD_CMS
+
FIELD_TYPE_BOOLEANS
+
"_"
;
public
static
final
String
PREFIX_FIELD_CMS_NUMBER
=
PREFIX_FIELD_CMS
+
FIELD_TYPE_NUMBER
+
"_"
;
public
static
final
String
PREFIX_FIELD_CMS_NUMBERS
=
PREFIX_FIELD_CMS
+
FIELD_TYPE_NUMBERS
+
"_"
;
public
static
final
String
PREFIX_FIELD_CMS_DATE
=
PREFIX_FIELD_CMS
+
FIELD_TYPE_DATE
+
"_"
;
public
static
final
String
PREFIX_FIELD_CMS_DATES
=
PREFIX_FIELD_CMS
+
FIELD_TYPE_DATES
+
"_"
;
private
static
final
String
[]
QUERY_IGNORES
=
new
String
[]
{
"["
,
"]"
,
"*"
,
"?"
};
private
static
final
String
[]
QUERY_IGNOREREPLACES
=
new
String
[]
{
""
,
""
,
""
,
""
};
...
...
@@ -328,19 +362,39 @@ public class Indexs {
if
(
ListTools
.
isEmpty
(
filters
))
{
return
list
;
}
List
<
Filter
>
fields
=
filters
.
stream
().
filter
(
o
->
FACET_FIELDS
.
contains
(
o
.
getField
()))
.
collect
(
Collectors
.
toList
());
if
(
ListTools
.
isEmpty
(
fields
))
{
return
list
;
}
fields
.
stream
().
map
(
Indexs:
:
fitlerQuery
).
filter
(
Optional:
:
isPresent
).
forEach
(
o
->
list
.
add
(
o
.
get
()));
filters
.
stream
().
map
(
Indexs:
:
fitlerQuery
).
filter
(
Optional:
:
isPresent
).
forEach
(
o
->
list
.
add
(
o
.
get
()));
return
list
;
}
private
static
Optional
<
org
.
apache
.
lucene
.
search
.
Query
>
fitlerQuery
(
Filter
filter
)
{
if
(
ListTools
.
isEmpty
(
filter
.
getValueList
()))
{
if
(
ListTools
.
isEmpty
(
filter
.
getValueList
())
&&
StringUtils
.
isEmpty
(
filter
.
getMin
())
&&
StringUtils
.
isEmpty
(
filter
.
getMax
()))
{
return
Optional
.
empty
();
}
if
(
filter
.
getField
().
startsWith
(
PREFIX_FIELD_DATA_DATE
))
{
if
(!(
StringUtils
.
isEmpty
(
filter
.
getMin
())
&&
StringUtils
.
isEmpty
(
filter
.
getMax
())))
{
return
Optional
.
of
(
LongPoint
.
newRangeQuery
(
filter
.
getField
(),
stringOfDateToLongElseMin
(
filter
.
getMin
()),
stringOfDateToLongElseMax
(
filter
.
getMax
())));
}
else
{
return
Optional
.
empty
();
}
}
if
(
filter
.
getField
().
startsWith
(
PREFIX_FIELD_DATA_NUMBER
))
{
if
(!(
StringUtils
.
isEmpty
(
filter
.
getMin
())
&&
StringUtils
.
isEmpty
(
filter
.
getMax
())))
{
return
Optional
.
of
(
LongPoint
.
newRangeQuery
(
filter
.
getField
(),
stringOfNumberToLongElseMin
(
filter
.
getMin
()),
stringOfNumberToLongElseMax
(
filter
.
getMax
())));
}
else
{
return
Optional
.
empty
();
}
}
if
(
filter
.
getField
().
startsWith
(
PREFIX_FIELD_DATA_BOOLEAN
))
{
String
value
=
StringUtils
.
equalsIgnoreCase
(
filter
.
getValueList
().
get
(
0
),
Indexs
.
BOOLEAN_TRUE_STRING_VALUE
)
?
BOOLEAN_TRUE_STRING_VALUE
:
BOOLEAN_FALSE_STRING_VALUE
;
return
Optional
.
of
(
new
TermQuery
(
new
Term
(
filter
.
getField
(),
value
)));
}
BooleanQuery
.
Builder
builder
=
new
BooleanQuery
.
Builder
();
filter
.
getValueList
().
stream
().
filter
(
StringUtils:
:
isNotBlank
)
.
map
(
o
->
new
TermQuery
(
new
Term
(
filter
.
getField
(),
o
)))
...
...
@@ -348,6 +402,36 @@ public class Indexs {
return
Optional
.
of
(
builder
.
build
());
}
private
static
Long
stringOfDateToLongElseMin
(
String
text
)
{
try
{
Date
date
=
DateTools
.
parse
(
text
);
return
date
.
getTime
();
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
new
IllegalArgumentException
(
"text:"
+
text
+
" can not parse to date."
,
e
));
}
return
Long
.
MIN_VALUE
;
}
private
static
Long
stringOfDateToLongElseMax
(
String
text
)
{
try
{
Date
date
=
DateTools
.
parse
(
text
);
return
date
.
getTime
();
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
new
IllegalArgumentException
(
"text:"
+
text
+
" can not parse to date."
,
e
));
}
return
Long
.
MAX_VALUE
;
}
private
static
Long
stringOfNumberToLongElseMin
(
String
text
)
{
Double
value
=
NumberUtils
.
toDouble
(
text
,
Double
.
MIN_VALUE
);
return
org
.
apache
.
lucene
.
util
.
NumericUtils
.
doubleToSortableLong
(
value
.
doubleValue
());
}
private
static
Long
stringOfNumberToLongElseMax
(
String
text
)
{
Double
value
=
NumberUtils
.
toDouble
(
text
,
Double
.
MAX_VALUE
);
return
org
.
apache
.
lucene
.
util
.
NumericUtils
.
doubleToSortableLong
(
value
.
doubleValue
());
}
public
static
List
<
String
>
adjustFacetField
(
List
<
String
>
categories
,
List
<
String
>
filters
)
{
List
<
String
>
list
=
FACET_FIELDS
.
stream
().
filter
(
o
->
(!
filters
.
contains
(
o
))).
collect
(
Collectors
.
toList
());
if
(
list
.
contains
(
FIELD_PROCESSNAME
))
{
...
...
@@ -380,6 +464,20 @@ public class Indexs {
*/
public
static
Triple
<
String
,
String
,
String
>
judgeField
(
String
field
)
{
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_DATA
))
{
return
judgeFieldData
(
field
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM
))
{
return
judgeFieldProcessPlatform
(
field
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_CMS
))
{
return
judgeFieldCms
(
field
);
}
else
if
(
FIXED_DATE_FIELDS
.
contains
(
field
))
{
return
Triple
.
of
(
field
,
field
,
Indexs
.
FIELD_TYPE_DATE
);
}
else
{
return
Triple
.
of
(
field
,
field
,
Indexs
.
FIELD_TYPE_STRING
);
}
}
private
static
Triple
<
String
,
String
,
String
>
judgeFieldData
(
String
field
)
{
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_DATA_STRING
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_DATA_STRING
),
Indexs
.
FIELD_TYPE_STRING
);
...
...
@@ -404,29 +502,99 @@ public class Indexs {
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_DATA_BOOLEANS
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_DATA_BOOLEANS
),
Indexs
.
FIELD_TYPE_BOOLEANS
);
}
else
if
(
FIXED_DATE_FIELDS
.
contains
(
field
))
{
return
Triple
.
of
(
field
,
field
,
Indexs
.
FIELD_TYPE_DATE
);
}
else
{
return
Triple
.
of
(
field
,
field
,
Indexs
.
FIELD_TYPE_STRING
);
}
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_DATA_STRING
),
Indexs
.
FIELD_TYPE_STRING
);
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
indexableFieldValue
(
IndexableField
indexableField
,
String
fileType
)
{
if
(
null
==
indexableField
)
{
return
null
;
private
static
Triple
<
String
,
String
,
String
>
judgeFieldProcessPlatform
(
String
field
)
{
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
),
Indexs
.
FIELD_TYPE_STRING
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_DATE
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_DATE
),
Indexs
.
FIELD_TYPE_DATE
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_NUMBER
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_NUMBER
),
Indexs
.
FIELD_TYPE_NUMBER
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_BOOLEAN
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_BOOLEAN
),
Indexs
.
FIELD_TYPE_BOOLEAN
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRINGS
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRINGS
),
Indexs
.
FIELD_TYPE_STRINGS
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_DATES
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_DATES
),
Indexs
.
FIELD_TYPE_DATES
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_NUMBERS
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_NUMBERS
),
Indexs
.
FIELD_TYPE_NUMBERS
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_BOOLEANS
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_BOOLEANS
),
Indexs
.
FIELD_TYPE_BOOLEANS
);
}
if
(
StringUtils
.
equalsIgnoreCase
(
Indexs
.
FIELD_TYPE_DATE
,
fileType
))
{
Number
number
=
indexableField
.
numericValue
();
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
),
Indexs
.
FIELD_TYPE_STRING
);
}
private
static
Triple
<
String
,
String
,
String
>
judgeFieldCms
(
String
field
)
{
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_CMS_STRING
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_CMS_STRING
),
Indexs
.
FIELD_TYPE_STRING
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_CMS_DATE
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_CMS_DATE
),
Indexs
.
FIELD_TYPE_DATE
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_CMS_NUMBER
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_CMS_NUMBER
),
Indexs
.
FIELD_TYPE_NUMBER
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_CMS_BOOLEAN
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_CMS_BOOLEAN
),
Indexs
.
FIELD_TYPE_BOOLEAN
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_CMS_STRINGS
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_CMS_STRINGS
),
Indexs
.
FIELD_TYPE_STRINGS
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_CMS_DATES
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_CMS_DATES
),
Indexs
.
FIELD_TYPE_DATES
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_CMS_NUMBERS
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_CMS_NUMBERS
),
Indexs
.
FIELD_TYPE_NUMBERS
);
}
else
if
(
StringUtils
.
startsWith
(
field
,
Indexs
.
PREFIX_FIELD_CMS_BOOLEANS
))
{
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_CMS_BOOLEANS
),
Indexs
.
FIELD_TYPE_BOOLEANS
);
}
return
Triple
.
of
(
field
,
StringUtils
.
substringAfter
(
field
,
Indexs
.
PREFIX_FIELD_CMS_STRING
),
Indexs
.
FIELD_TYPE_STRING
);
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
indexableFieldValue
(
IndexableField
[]
indexableFields
,
String
fileType
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
Indexs
.
FIELD_TYPE_DATES
,
fileType
))
{
return
(
T
)
Stream
.
of
(
indexableFields
).
map
(
IndexableField:
:
numericValue
).
filter
(
o
->
!
Objects
.
isNull
(
o
))
.<
Date
>
map
(
o
->
new
Date
(
o
.
longValue
())).
collect
(
Collectors
.
toList
());
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
Indexs
.
FIELD_TYPE_NUMBERS
,
fileType
))
{
return
(
T
)
Stream
.
of
(
indexableFields
).
map
(
IndexableField:
:
numericValue
).
filter
(
o
->
!
Objects
.
isNull
(
o
))
.<
Double
>
map
(
o
->
Double
.
valueOf
(
NumericUtils
.
sortableLongToDouble
(
o
.
longValue
())))
.
collect
(
Collectors
.
toList
());
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
Indexs
.
FIELD_TYPE_BOOLEANS
,
fileType
))
{
return
(
T
)
Stream
.
of
(
indexableFields
).
map
(
IndexableField:
:
stringValue
).
filter
(
o
->
!
Objects
.
isNull
(
o
))
.<
Boolean
>
map
(
o
->
Boolean
.
valueOf
(
StringUtils
.
equalsIgnoreCase
(
o
,
BOOLEAN_TRUE_STRING_VALUE
)))
.
collect
(
Collectors
.
toList
());
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
Indexs
.
FIELD_TYPE_STRINGS
,
fileType
))
{
return
(
T
)
Stream
.
of
(
indexableFields
).<
String
>
map
(
IndexableField:
:
stringValue
)
.
filter
(
o
->
!
Objects
.
isNull
(
o
))
.
collect
(
Collectors
.
toList
());
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
Indexs
.
FIELD_TYPE_DATE
,
fileType
))
{
Number
number
=
indexableFields
[
0
].
numericValue
();
return
(
null
!=
number
)
?
(
T
)
new
Date
(
number
.
longValue
())
:
null
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
Indexs
.
FIELD_TYPE_NUMBER
,
fileType
))
{
Number
number
=
indexableField
.
numericValue
();
Number
number
=
indexableField
s
[
0
]
.
numericValue
();
return
(
null
!=
number
)
?
(
T
)
Double
.
valueOf
(
NumericUtils
.
sortableLongToDouble
(
number
.
longValue
()))
:
null
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
Indexs
.
FIELD_TYPE_BOOLEAN
,
fileType
))
{
String
str
=
indexableField
.
stringValue
();
String
str
=
indexableField
s
[
0
]
.
stringValue
();
return
(
T
)
Boolean
.
valueOf
(
StringUtils
.
equalsIgnoreCase
(
str
,
BOOLEAN_TRUE_STRING_VALUE
));
}
else
{
String
str
=
indexableField
.
stringValue
();
String
str
=
indexableField
s
[
0
]
.
stringValue
();
return
(
null
!=
str
)
?
(
T
)
str
:
null
;
}
}
...
...
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/index/Doc.java
浏览文件 @
eaf52ec4
package
com.x.query.service.processing.index
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -7,6 +8,7 @@ import java.util.Map;
import
java.util.Objects
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.lucene.document.Field
;
import
org.apache.lucene.document.LongPoint
;
import
org.apache.lucene.document.NumericDocValuesField
;
...
...
@@ -51,8 +53,6 @@ public class Doc extends GsonPropertyObject {
private
String
creatorUnit
;
private
Boolean
completed
;
private
List
<
String
>
readers
;
private
Map
<
String
,
String
>
stringRepo
=
new
HashMap
<>();
...
...
@@ -60,92 +60,10 @@ public class Doc extends GsonPropertyObject {
private
Map
<
String
,
Boolean
>
booleanRepo
=
new
HashMap
<>();
private
Map
<
String
,
Number
>
numberRepo
=
new
HashMap
<>();
private
Map
<
String
,
List
<
String
>>
stringListRepo
=
new
HashMap
<>();
private
Map
<
String
,
List
<
Date
>>
dateListRepo
=
new
HashMap
<>();
private
Map
<
String
,
List
<
Boolean
>>
booleanListRepo
=
new
HashMap
<>();
private
Map
<
String
,
List
<
Number
>>
numberListRepo
=
new
HashMap
<>();
private
Map
<
String
,
String
>
dataStringRepo
=
new
HashMap
<>();
private
Map
<
String
,
Date
>
dataDateRepo
=
new
HashMap
<>();
private
Map
<
String
,
Boolean
>
dataBooleanRepo
=
new
HashMap
<>();
private
Map
<
String
,
Number
>
dataNumberRepo
=
new
HashMap
<>();
private
Map
<
String
,
List
<
String
>>
dataStringListRepo
=
new
HashMap
<>();
private
Map
<
String
,
List
<
Date
>>
dataDateListRepo
=
new
HashMap
<>();
private
Map
<
String
,
List
<
Boolean
>>
dataBooleanListRepo
=
new
HashMap
<>();
private
Map
<
String
,
List
<
Number
>>
dataNumberListRepo
=
new
HashMap
<>();
public
Boolean
getCompleted
()
{
return
completed
;
}
public
void
setCompleted
(
Boolean
completed
)
{
this
.
completed
=
completed
;
}
public
Map
<
String
,
String
>
getStringRepo
()
{
return
stringRepo
;
}
public
Map
<
String
,
Date
>
getDateRepo
()
{
return
dateRepo
;
}
public
Map
<
String
,
Boolean
>
getBooleanRepo
()
{
return
booleanRepo
;
}
public
Map
<
String
,
Number
>
getNumberRepo
()
{
return
numberRepo
;
}
public
Map
<
String
,
List
<
String
>>
getStringListRepo
()
{
return
stringListRepo
;
}
public
Map
<
String
,
List
<
Date
>>
getDateListRepo
()
{
return
dateListRepo
;
}
public
Map
<
String
,
List
<
Boolean
>>
getBooleanListRepo
()
{
return
booleanListRepo
;
}
public
Map
<
String
,
List
<
Number
>>
getNumberListRepo
()
{
return
numberListRepo
;
}
public
Map
<
String
,
String
>
getDataStringRepo
()
{
return
dataStringRepo
;
}
public
Map
<
String
,
Date
>
getDataDateRepo
()
{
return
dataDateRepo
;
}
public
Map
<
String
,
Boolean
>
getDataBooleanRepo
()
{
return
dataBooleanRepo
;
}
public
Map
<
String
,
Number
>
getDataNumberRepo
()
{
return
dataNumberRepo
;
}
public
Map
<
String
,
List
<
String
>>
getDataStringListRepo
()
{
return
dataStringListRepo
;
}
public
Map
<
String
,
List
<
Date
>>
getDataDateListRepo
()
{
return
dataDateListRepo
;
}
public
Map
<
String
,
List
<
Boolean
>>
getDataBooleanListRepo
()
{
return
dataBooleanListRepo
;
}
public
Map
<
String
,
List
<
Number
>>
getDataNumberListRepo
()
{
return
dataNumberListRepo
;
}
private
Map
<
String
,
Collection
<
String
>>
stringsRepo
=
new
HashMap
<>();
private
Map
<
String
,
Collection
<
Date
>>
datesRepo
=
new
HashMap
<>();
private
Map
<
String
,
Collection
<
Boolean
>>
booleansRepo
=
new
HashMap
<>();
private
Map
<
String
,
Collection
<
Number
>>
numbersRepo
=
new
HashMap
<>();
public
String
getAttachment
()
{
return
attachment
;
...
...
@@ -267,74 +185,66 @@ public class Doc extends GsonPropertyObject {
this
.
updateTimeMonth
=
updateTimeMonth
;
}
public
void
addString
(
String
name
,
String
value
)
{
stringRepo
.
put
(
name
,
value
);
}
public
void
addDate
(
String
name
,
Date
value
)
{
dateRepo
.
put
(
name
,
value
);
}
public
void
addBoolean
(
String
name
,
Boolean
value
)
{
booleanRepo
.
put
(
name
,
value
);
}
public
void
addNumber
(
String
name
,
Number
value
)
{
numberRepo
.
put
(
name
,
value
);
}
public
void
addStringList
(
String
name
,
List
<
String
>
values
)
{
stringListRepo
.
put
(
name
,
values
);
}
public
void
addDateList
(
String
name
,
List
<
Date
>
values
)
{
dateListRepo
.
put
(
name
,
values
);
}
public
void
addBooleanList
(
String
name
,
List
<
Boolean
>
values
)
{
booleanListRepo
.
put
(
name
,
values
);
}
public
void
addNumberList
(
String
name
,
List
<
Number
>
values
)
{
numberListRepo
.
put
(
name
,
values
);
}
public
void
dataAddString
(
String
name
,
String
value
)
{
dataStringRepo
.
put
(
name
,
value
);
public
Doc
addString
(
String
prefix
,
String
field
,
String
value
)
{
if
(
StringUtils
.
isNotBlank
(
value
))
{
this
.
stringRepo
.
put
(
prefix
+
field
,
value
);
}
return
this
;
}
public
void
dataAddDate
(
String
name
,
Date
value
)
{
dataDateRepo
.
put
(
name
,
value
);
public
Doc
addDate
(
String
prefix
,
String
field
,
Date
value
)
{
if
(
null
!=
value
)
{
this
.
dateRepo
.
put
(
prefix
+
field
,
value
);
}
return
this
;
}
public
void
dataAddBoolean
(
String
name
,
Boolean
value
)
{
dataBooleanRepo
.
put
(
name
,
value
);
public
Doc
addBoolean
(
String
prefix
,
String
field
,
Boolean
value
)
{
if
(
null
!=
value
)
{
this
.
booleanRepo
.
put
(
prefix
+
field
,
value
);
}
return
this
;
}
public
void
dataAddNumber
(
String
name
,
Number
value
)
{
dataNumberRepo
.
put
(
name
,
value
);
public
Doc
addNumber
(
String
prefix
,
String
field
,
Number
value
)
{
if
(
null
!=
value
)
{
this
.
numberRepo
.
put
(
prefix
+
field
,
value
);
}
return
this
;
}
public
void
dataAddStringList
(
String
name
,
List
<
String
>
values
)
{
dataStringListRepo
.
put
(
name
,
values
);
public
Doc
addStrings
(
String
prefix
,
String
field
,
Collection
<
String
>
values
)
{
if
((
null
!=
values
)
&&
(!
values
.
isEmpty
()))
{
this
.
stringsRepo
.
put
(
prefix
+
field
,
values
);
}
return
this
;
}
public
void
dataAddDateList
(
String
name
,
List
<
Date
>
values
)
{
dataDateListRepo
.
put
(
name
,
values
);
public
Doc
addDates
(
String
prefix
,
String
field
,
Collection
<
Date
>
values
)
{
if
((
null
!=
values
)
&&
(!
values
.
isEmpty
()))
{
this
.
datesRepo
.
put
(
prefix
+
field
,
values
);
}
return
this
;
}
public
void
dataAddBooleanList
(
String
name
,
List
<
Boolean
>
values
)
{
dataBooleanListRepo
.
put
(
name
,
values
);
public
Doc
addBooleans
(
String
prefix
,
String
field
,
Collection
<
Boolean
>
values
)
{
if
((
null
!=
values
)
&&
(!
values
.
isEmpty
()))
{
this
.
booleansRepo
.
put
(
prefix
+
field
,
values
);
}
return
this
;
}
public
void
dataAddNumberList
(
String
name
,
List
<
Number
>
values
)
{
dataNumberListRepo
.
put
(
name
,
values
);
public
Doc
addNumbers
(
String
prefix
,
String
field
,
Collection
<
Number
>
values
)
{
if
((
null
!=
values
)
&&
(!
values
.
isEmpty
()))
{
this
.
numbersRepo
.
put
(
prefix
+
field
,
values
);
}
return
this
;
}
public
org
.
apache
.
lucene
.
document
.
Document
toDocument
(
boolean
convertData
)
{
org
.
apache
.
lucene
.
document
.
Document
document
=
new
org
.
apache
.
lucene
.
document
.
Document
();
document
.
add
(
new
StringField
(
Indexs
.
FIELD_ID
,
this
.
getId
(),
Field
.
Store
.
YES
));
document
.
add
(
new
TextField
(
Indexs
.
FIELD_TITLE
,
Objects
.
toString
(
this
.
getTitle
(),
""
),
Field
.
Store
.
YES
));
addTitle
(
document
,
this
.
getTitle
(
));
document
.
add
(
new
TextField
(
Indexs
.
FIELD_SUMMARY
,
Objects
.
toString
(
this
.
getSummary
(),
""
),
Field
.
Store
.
YES
));
document
.
add
(
new
TextField
(
Indexs
.
FIELD_BODY
,
Objects
.
toString
(
this
.
getBody
(),
""
),
Field
.
Store
.
YES
));
document
.
add
(
...
...
@@ -349,28 +259,33 @@ public class Doc extends GsonPropertyObject {
addDate
(
document
,
Indexs
.
FIELD_INDEXTIME
,
new
Date
());
addDate
(
document
,
Indexs
.
FIELD_CREATETIME
,
this
.
getCreateTime
());
addDate
(
document
,
Indexs
.
FIELD_UPDATETIME
,
this
.
getUpdateTime
());
addBoolean
(
document
,
Indexs
.
FIELD_COMPLETED
,
this
.
getCompleted
());
if
(
convertData
)
{
this
.
getStringRepo
()
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
this
.
stringRepo
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addString
(
document
,
o
.
getKey
(),
o
.
getValue
()));
this
.
getDateRepo
()
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
this
.
dateRepo
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addDate
(
document
,
o
.
getKey
(),
o
.
getValue
()));
this
.
getNumberRepo
()
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
this
.
numberRepo
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addNumber
(
document
,
o
.
getKey
(),
o
.
getValue
()));
this
.
getBooleanRepo
().
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addBoolean
(
document
,
o
.
getKey
(),
o
.
getValue
()));
this
.
getDataStringRepo
()
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addString
(
document
,
Indexs
.
PREFIX_FIELD_DATA_STRING
+
o
.
getKey
(),
o
.
getValue
()));
this
.
getDataDateRepo
()
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addDate
(
document
,
Indexs
.
PREFIX_FIELD_DATA_DATE
+
o
.
getKey
(),
o
.
getValue
()));
this
.
getDataNumberRepo
()
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addNumber
(
document
,
Indexs
.
PREFIX_FIELD_DATA_NUMBER
+
o
.
getKey
(),
o
.
getValue
()));
this
.
getDataBooleanRepo
()
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
()).
forEach
(
o
->
addBoolean
(
document
,
Indexs
.
PREFIX_FIELD_DATA_BOOLEAN
+
o
.
getKey
(),
o
.
getValue
()));
this
.
booleanRepo
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
()).
forEach
(
o
->
addBoolean
(
document
,
o
.
getKey
(),
o
.
getValue
()));
this
.
stringsRepo
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addString
s
(
document
,
o
.
getKey
(),
o
.
getValue
()));
this
.
datesRepo
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addDate
s
(
document
,
o
.
getKey
(),
o
.
getValue
()));
this
.
numbersRepo
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
())
.
forEach
(
o
->
addNumber
s
(
document
,
o
.
getKey
(),
o
.
getValue
()));
this
.
booleansRepo
.
entrySet
().
stream
().
filter
(
o
->
null
!=
o
.
getValue
()).
forEach
(
o
->
addBoolean
s
(
document
,
o
.
getKey
(),
o
.
getValue
()));
}
return
document
;
}
private
void
addTitle
(
org
.
apache
.
lucene
.
document
.
Document
document
,
String
value
)
{
String
str
=
Objects
.
toString
(
this
.
getTitle
(),
""
);
document
.
add
(
new
TextField
(
Indexs
.
FIELD_TITLE
,
str
,
Field
.
Store
.
YES
));
document
.
add
(
new
SortedDocValuesField
(
Indexs
.
FIELD_TITLE
,
new
BytesRef
(
str
)));
}
private
void
addString
(
org
.
apache
.
lucene
.
document
.
Document
document
,
String
field
,
String
value
)
{
document
.
add
(
new
SortedDocValuesField
(
field
,
new
BytesRef
(
value
)));
document
.
add
(
new
StringField
(
field
,
value
,
Field
.
Store
.
YES
));
...
...
@@ -397,4 +312,34 @@ public class Doc extends GsonPropertyObject {
document
.
add
(
new
StringField
(
field
,
store
,
Field
.
Store
.
YES
));
}
private
void
addStrings
(
org
.
apache
.
lucene
.
document
.
Document
document
,
String
field
,
Collection
<
String
>
values
)
{
values
.
stream
().
filter
(
o
->
!
Objects
.
isNull
(
o
))
.
forEach
(
o
->
document
.
add
(
new
StringField
(
field
,
o
,
Field
.
Store
.
YES
)));
}
private
void
addNumbers
(
org
.
apache
.
lucene
.
document
.
Document
document
,
String
field
,
Collection
<
Number
>
values
)
{
values
.
stream
().
filter
(
o
->
!
Objects
.
isNull
(
o
)).
forEach
(
o
->
{
long
store
=
org
.
apache
.
lucene
.
util
.
NumericUtils
.
doubleToSortableLong
(
o
.
doubleValue
());
document
.
add
(
new
LongPoint
(
field
,
store
));
document
.
add
(
new
StoredField
(
field
,
store
));
});
}
private
void
addDates
(
org
.
apache
.
lucene
.
document
.
Document
document
,
String
field
,
Collection
<
Date
>
values
)
{
values
.
stream
().
filter
(
o
->
!
Objects
.
isNull
(
o
)).
forEach
(
o
->
{
long
store
=
o
.
getTime
();
document
.
add
(
new
LongPoint
(
field
,
store
));
document
.
add
(
new
StoredField
(
field
,
store
));
});
}
private
void
addBooleans
(
org
.
apache
.
lucene
.
document
.
Document
document
,
String
field
,
Collection
<
Boolean
>
values
)
{
values
.
stream
().
filter
(
o
->
!
Objects
.
isNull
(
o
)).
forEach
(
o
->
{
String
store
=
BooleanUtils
.
isTrue
(
o
)
?
Indexs
.
BOOLEAN_TRUE_STRING_VALUE
:
Indexs
.
BOOLEAN_FALSE_STRING_VALUE
;
document
.
add
(
new
StringField
(
field
,
store
,
Field
.
Store
.
YES
));
});
}
}
\ No newline at end of file
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/index/DocFunction.java
浏览文件 @
eaf52ec4
...
...
@@ -37,6 +37,8 @@ import com.x.cms.core.entity.FileInfo;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Data
;
import
com.x.processplatform.core.entity.content.Review
;
import
com.x.processplatform.core.entity.content.Task
;
import
com.x.processplatform.core.entity.content.TaskCompleted
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
com.x.processplatform.core.entity.element.Process
;
...
...
@@ -55,6 +57,7 @@ public class DocFunction {
private
static
final
List
<
String
>
PROCESSPLATFORM_REVIEW_FIELDS
=
new
UnmodifiableList
<>(
Arrays
.
asList
(
Review
.
person_FIELDNAME
));
private
static
final
List
<
String
>
CMS_REVIEW_FIELDS
=
new
UnmodifiableList
<>(
Arrays
.
asList
(
com
.
x
.
cms
.
core
.
entity
.
Review
.
permissionObj_FIELDNAME
));
...
...
@@ -70,7 +73,6 @@ public class DocFunction {
LOGGER
.
debug
(
"DocFunction wrapWork:{}."
,
param
.
second
());
Doc
doc
=
new
Doc
();
doc
.
setReaders
(
readers
(
param
.
first
(),
work
));
doc
.
setCompleted
(
false
);
doc
.
setId
(
work
.
getJob
());
doc
.
setCategory
(
Indexs
.
CATEGORY_PROCESSPLATFORM
);
doc
.
setType
(
Indexs
.
TYPE_WORKCOMPLETED
);
...
...
@@ -82,15 +84,25 @@ public class DocFunction {
doc
.
setUpdateTimeMonth
(
DateTools
.
format
(
work
.
getUpdateTime
(),
DateTools
.
format_yyyyMM
));
doc
.
setCreatorPerson
(
OrganizationDefinition
.
name
(
work
.
getCreatorPerson
()));
doc
.
setCreatorUnit
(
OrganizationDefinition
.
name
(
work
.
getCreatorUnit
()));
doc
.
addString
(
Indexs
.
FIELD_CREATORUNITLEVELNAME
,
work
.
getCreatorUnitLevelName
());
doc
.
addString
(
Indexs
.
FIELD_APPLICATION
,
work
.
getApplication
());
doc
.
addString
(
Indexs
.
FIELD_APPLICATIONNAME
,
work
.
getApplicationName
());
doc
.
addString
(
Indexs
.
FIELD_APPLICATIONALIAS
,
work
.
getApplicationAlias
());
doc
.
addString
(
Indexs
.
FIELD_PROCESS
,
work
.
getProcess
());
doc
.
addString
(
Indexs
.
FIELD_PROCESSNAME
,
work
.
getProcessName
());
doc
.
addString
(
Indexs
.
FIELD_PROCESSALIAS
,
work
.
getProcessAlias
());
doc
.
addString
(
Indexs
.
FIELD_JOB
,
work
.
getJob
());
doc
.
addString
(
Indexs
.
FIELD_SERIAL
,
work
.
getSerial
());
doc
.
addBoolean
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_BOOLEAN
,
TaskCompleted
.
completed_FIELDNAME
,
false
);
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
creatorUnitLevelName_FIELDNAME
,
work
.
getCreatorUnitLevelName
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
application_FIELDNAME
,
work
.
getApplication
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
applicationName_FIELDNAME
,
work
.
getApplicationName
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
applicationAlias_FIELDNAME
,
work
.
getApplicationAlias
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
process_FIELDNAME
,
work
.
getProcess
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
processName_FIELDNAME
,
work
.
getProcessName
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
processAlias_FIELDNAME
,
work
.
getProcessAlias
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
job_FIELDNAME
,
work
.
getJob
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
serial_FIELDNAME
,
work
.
getSerial
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
Work
.
activityName_FIELDNAME
,
work
.
getActivityName
());
workAddTaskPersonNames
(
doc
,
param
.
first
(),
work
);
update
(
param
.
first
(),
work
,
doc
);
return
Pair
.
of
(
work
.
getApplication
(),
Optional
.
of
(
doc
));
}
...
...
@@ -108,7 +120,6 @@ public class DocFunction {
LOGGER
.
debug
(
"DocFunction wrapWorkCompleted:{}."
,
param
.
second
());
Doc
doc
=
new
Doc
();
doc
.
setReaders
(
readers
(
param
.
first
(),
workCompleted
));
doc
.
setCompleted
(
true
);
doc
.
setId
(
workCompleted
.
getJob
());
doc
.
setCategory
(
Indexs
.
CATEGORY_PROCESSPLATFORM
);
doc
.
setType
(
Indexs
.
TYPE_WORKCOMPLETED
);
...
...
@@ -120,17 +131,29 @@ public class DocFunction {
doc
.
setUpdateTimeMonth
(
DateTools
.
format
(
workCompleted
.
getUpdateTime
(),
DateTools
.
format_yyyyMM
));
doc
.
setCreatorPerson
(
OrganizationDefinition
.
name
(
workCompleted
.
getCreatorPerson
()));
doc
.
setCreatorUnit
(
OrganizationDefinition
.
name
(
workCompleted
.
getCreatorUnit
()));
doc
.
addString
(
Indexs
.
FIELD_CREATORUNITLEVELNAME
,
workCompleted
.
getCreatorUnitLevelName
());
doc
.
addString
(
Indexs
.
FIELD_APPLICATION
,
workCompleted
.
getApplication
());
doc
.
addString
(
Indexs
.
FIELD_APPLICATIONNAME
,
workCompleted
.
getApplicationName
());
doc
.
addString
(
Indexs
.
FIELD_APPLICATIONALIAS
,
workCompleted
.
getApplicationAlias
());
doc
.
addString
(
Indexs
.
FIELD_PROCESS
,
workCompleted
.
getProcess
());
doc
.
addString
(
Indexs
.
FIELD_PROCESSNAME
,
workCompleted
.
getProcessName
());
doc
.
addString
(
Indexs
.
FIELD_PROCESSALIAS
,
workCompleted
.
getProcessAlias
());
doc
.
addString
(
Indexs
.
FIELD_JOB
,
workCompleted
.
getJob
());
doc
.
addString
(
Indexs
.
FIELD_SERIAL
,
workCompleted
.
getSerial
());
doc
.
addBoolean
(
Indexs
.
FIELD_EXPIRED
,
workCompleted
.
getExpired
());
doc
.
addDate
(
Indexs
.
FIELD_EXPIRETIME
,
workCompleted
.
getExpireTime
());
doc
.
addBoolean
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_BOOLEAN
,
TaskCompleted
.
completed_FIELDNAME
,
true
);
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
WorkCompleted
.
creatorUnitLevelName_FIELDNAME
,
workCompleted
.
getCreatorUnitLevelName
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
WorkCompleted
.
application_FIELDNAME
,
workCompleted
.
getApplication
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
WorkCompleted
.
applicationName_FIELDNAME
,
workCompleted
.
getApplicationName
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
WorkCompleted
.
applicationAlias_FIELDNAME
,
workCompleted
.
getApplicationAlias
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
WorkCompleted
.
process_FIELDNAME
,
workCompleted
.
getProcess
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
WorkCompleted
.
processName_FIELDNAME
,
workCompleted
.
getProcessName
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
WorkCompleted
.
processAlias_FIELDNAME
,
workCompleted
.
getProcessAlias
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
WorkCompleted
.
job_FIELDNAME
,
workCompleted
.
getJob
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRING
,
WorkCompleted
.
serial_FIELDNAME
,
workCompleted
.
getSerial
());
doc
.
addBoolean
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_BOOLEAN
,
WorkCompleted
.
expired_FIELDNAME
,
workCompleted
.
getExpired
());
doc
.
addDate
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_DATE
,
WorkCompleted
.
expireTime_FIELDNAME
,
workCompleted
.
getExpireTime
());
update
(
param
.
first
(),
workCompleted
,
doc
);
return
Pair
.
of
(
workCompleted
.
getApplication
(),
Optional
.
of
(
doc
));
}
...
...
@@ -158,15 +181,19 @@ public class DocFunction {
doc
.
setUpdateTimeMonth
(
DateTools
.
format
(
document
.
getUpdateTime
(),
DateTools
.
format_yyyyMM
));
doc
.
setCreatorPerson
(
OrganizationDefinition
.
name
(
document
.
getCreatorPerson
()));
doc
.
setCreatorUnit
(
OrganizationDefinition
.
name
(
document
.
getCreatorUnitName
()));
doc
.
addString
(
Indexs
.
FIELD_APPID
,
document
.
getAppId
());
doc
.
addString
(
Indexs
.
FIELD_APPNAME
,
document
.
getAppName
());
doc
.
addString
(
Indexs
.
FIELD_APPALIAS
,
document
.
getAppAlias
());
doc
.
addString
(
Indexs
.
FIELD_CATEGORYID
,
document
.
getCategoryId
());
doc
.
addString
(
Indexs
.
FIELD_CATEGORYNAME
,
document
.
getCategoryName
());
doc
.
addString
(
Indexs
.
FIELD_CATEGORYALIAS
,
document
.
getCategoryAlias
());
doc
.
addString
(
Indexs
.
FIELD_DESCRIPTION
,
document
.
getDescription
());
doc
.
addDate
(
Indexs
.
FIELD_PUBLISHTIME
,
document
.
getPublishTime
());
doc
.
addDate
(
Indexs
.
FIELD_MODIFYTIME
,
document
.
getModifyTime
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_CMS_STRING
,
Document
.
appId_FIELDNAME
,
document
.
getAppId
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_CMS_STRING
,
Document
.
appName_FIELDNAME
,
document
.
getAppName
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_CMS_STRING
,
Document
.
appAlias_FIELDNAME
,
document
.
getAppAlias
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_CMS_STRING
,
Document
.
categoryId_FIELDNAME
,
document
.
getCategoryId
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_CMS_STRING
,
Document
.
categoryName_FIELDNAME
,
document
.
getCategoryName
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_CMS_STRING
,
Document
.
categoryAlias_FIELDNAME
,
document
.
getCategoryAlias
());
doc
.
addString
(
Indexs
.
PREFIX_FIELD_CMS_STRING
,
Indexs
.
FIELD_DESCRIPTION
,
document
.
getDescription
());
doc
.
addDate
(
Indexs
.
PREFIX_FIELD_CMS_STRING
,
Indexs
.
FIELD_PUBLISHTIME
,
document
.
getPublishTime
());
doc
.
addDate
(
Indexs
.
PREFIX_FIELD_CMS_STRING
,
Indexs
.
FIELD_MODIFYTIME
,
document
.
getModifyTime
());
update
(
param
.
first
(),
document
,
doc
,
Config
.
query
().
index
().
getDataStringThreshold
());
return
Pair
.
of
(
document
.
getAppId
(),
Optional
.
of
(
doc
));
}
...
...
@@ -195,6 +222,19 @@ public class DocFunction {
return
list
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
private
static
void
workAddTaskPersonNames
(
Doc
doc
,
Business
business
,
Work
work
)
throws
Exception
{
List
<
Task
>
list
=
business
.
entityManagerContainer
().
listEqualAndEqual
(
Task
.
class
,
Task
.
job_FIELDNAME
,
work
.
getJob
(),
Task
.
application_FIELDNAME
,
work
.
getApplication
());
doc
.
addStrings
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRINGS
,
Indexs
.
FIELD_ROCESSPLATFORM_TASKPERSONNAMES
,
list
.
stream
().
map
(
Task:
:
getPerson
).
filter
(
StringUtils:
:
isNotBlank
)
.
map
(
OrganizationDefinition:
:
name
).
distinct
()
.
collect
(
Collectors
.
toList
()));
doc
.
addStrings
(
Indexs
.
PREFIX_FIELD_PROCESSPLATFORM_STRINGS
,
Indexs
.
FIELD_ROCESSPLATFORM_PRETASKPERSONNAMES
,
list
.
stream
().
map
(
Task:
:
getPerson
).
filter
(
StringUtils:
:
isNotBlank
)
.
map
(
OrganizationDefinition:
:
name
).
distinct
()
.
collect
(
Collectors
.
toList
()));
}
private
static
List
<
String
>
readers
(
Business
business
,
WorkCompleted
workCompleted
)
throws
Exception
{
List
<
String
>
list
=
business
.
entityManagerContainer
()
.
fetchEqualAndEqual
(
Review
.
class
,
PROCESSPLATFORM_REVIEW_FIELDS
,
Review
.
job_FIELDNAME
,
...
...
@@ -320,18 +360,18 @@ public class DocFunction {
if
(
StringUtils
.
length
(
value
)
<=
dataStringThreshold
)
{
if
(
BooleanUtils
.
isTrue
(
DateTools
.
isDateTimeOrDateOrTime
(
value
)))
{
try
{
doc
.
addDate
(
Indexs
.
PREFIX_FIELD_DATA_DATE
+
name
,
DateTools
.
parse
(
value
));
doc
.
addDate
(
Indexs
.
PREFIX_FIELD_DATA_DATE
,
name
,
DateTools
.
parse
(
value
));
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
}
else
{
doc
.
addString
(
Indexs
.
PREFIX_FIELD_DATA_STRING
+
name
,
value
);
doc
.
addString
(
Indexs
.
PREFIX_FIELD_DATA_STRING
,
name
,
value
);
}
}
}
else
if
(
jsonPrimitive
.
isBoolean
())
{
doc
.
addBoolean
(
Indexs
.
PREFIX_FIELD_DATA_BOOLEAN
+
name
,
jsonPrimitive
.
getAsBoolean
());
doc
.
addBoolean
(
Indexs
.
PREFIX_FIELD_DATA_BOOLEAN
,
name
,
jsonPrimitive
.
getAsBoolean
());
}
else
if
(
jsonPrimitive
.
isNumber
())
{
doc
.
addNumber
(
Indexs
.
PREFIX_FIELD_DATA_NUMBER
+
name
,
jsonPrimitive
.
getAsNumber
());
doc
.
addNumber
(
Indexs
.
PREFIX_FIELD_DATA_NUMBER
,
name
,
jsonPrimitive
.
getAsNumber
());
}
}
...
...
@@ -347,10 +387,10 @@ public class DocFunction {
if
(
BooleanUtils
.
isTrue
(
list
.
stream
().
map
(
JsonPrimitive:
:
isString
).
reduce
(
true
,
(
a
,
b
)
->
a
&&
b
)))
{
updateArrayString
(
doc
,
name
,
list
);
}
else
if
(
BooleanUtils
.
isTrue
(
list
.
stream
().
map
(
JsonPrimitive:
:
isNumber
).
reduce
(
true
,
(
a
,
b
)
->
a
&&
b
)))
{
doc
.
addNumber
List
(
Indexs
.
PREFIX_FIELD_DATA_NUMBERS
+
name
,
doc
.
addNumber
s
(
Indexs
.
PREFIX_FIELD_DATA_NUMBERS
,
name
,
list
.
stream
().
map
(
JsonPrimitive:
:
getAsNumber
).
collect
(
Collectors
.
toList
()));
}
else
if
(
BooleanUtils
.
isTrue
(
list
.
stream
().
map
(
JsonPrimitive:
:
isBoolean
).
reduce
(
true
,
(
a
,
b
)
->
a
&&
b
)))
{
doc
.
addBoolean
List
(
Indexs
.
PREFIX_FIELD_DATA_BOOLEANS
+
name
,
doc
.
addBoolean
s
(
Indexs
.
PREFIX_FIELD_DATA_BOOLEANS
,
name
,
list
.
stream
().
map
(
JsonPrimitive:
:
getAsBoolean
).
collect
(
Collectors
.
toList
()));
}
}
...
...
@@ -359,7 +399,7 @@ public class DocFunction {
List
<
String
>
values
=
list
.
stream
().
map
(
JsonPrimitive:
:
getAsString
).
collect
(
Collectors
.
toList
());
if
(
BooleanUtils
.
isTrue
(
values
.
stream
().
map
(
DateTools:
:
isDateTimeOrDateOrTime
).
reduce
(
true
,
(
a
,
b
)
->
a
&&
b
)))
{
wrap
.
addDate
List
(
Indexs
.
PREFIX_FIELD_DATA_DATES
+
name
,
values
.
stream
().
map
(
s
->
{
wrap
.
addDate
s
(
Indexs
.
PREFIX_FIELD_DATA_DATES
,
name
,
values
.
stream
().
map
(
s
->
{
try
{
return
DateTools
.
parse
(
s
);
}
catch
(
Exception
e
)
{
...
...
@@ -368,7 +408,7 @@ public class DocFunction {
return
null
;
}).
collect
(
Collectors
.
toList
()));
}
else
{
wrap
.
addString
List
(
Indexs
.
PREFIX_FIELD_DATA_STRINGS
+
name
,
values
);
wrap
.
addString
s
(
Indexs
.
PREFIX_FIELD_DATA_STRINGS
,
name
,
values
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录