mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-02 17:09:18 +00:00
Query DSL: don't cache type filter in DocumentMapper
If we cache the type filter and we e.g. set its boost which is now settable on all queries, the boost will change for all subsequent queries. We should rather create a new query every time.
This commit is contained in:
parent
00ae4bb792
commit
8e931d5767
@ -168,8 +168,6 @@ public class DocumentMapper implements ToXContent {
|
||||
|
||||
private boolean hasNestedObjects = false;
|
||||
|
||||
private final Query typeFilter;
|
||||
|
||||
private final ReleasableLock mappingWriteLock;
|
||||
private final ReentrantReadWriteLock mappingLock;
|
||||
|
||||
@ -190,7 +188,6 @@ public class DocumentMapper implements ToXContent {
|
||||
meta);
|
||||
this.documentParser = new DocumentParser(indexSettings, docMapperParser, this, new ReleasableLock(mappingLock.readLock()));
|
||||
|
||||
this.typeFilter = typeMapper().fieldType().termQuery(type, null);
|
||||
this.mappingWriteLock = new ReleasableLock(mappingLock.writeLock());
|
||||
this.mappingLock = mappingLock;
|
||||
|
||||
@ -307,7 +304,7 @@ public class DocumentMapper implements ToXContent {
|
||||
}
|
||||
|
||||
public Query typeFilter() {
|
||||
return this.typeFilter;
|
||||
return typeMapper().fieldType().termQuery(type, null);
|
||||
}
|
||||
|
||||
public boolean hasNestedObjects() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user