-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSEARCH-4950 Change how nesting/knn checks are performed
- Loading branch information
1 parent
fee3690
commit c36fb12
Showing
17 changed files
with
177 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...hibernate/search/backend/elasticsearch/search/predicate/impl/PredicateNestingContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.backend.elasticsearch.search.predicate.impl; | ||
|
||
public class PredicateNestingContext { | ||
private static final PredicateNestingContext ACCEPTS_KNN = new PredicateNestingContext( true ); | ||
private static final PredicateNestingContext DOES_NOT_ACCEPT_KNN = new PredicateNestingContext( false ); | ||
private final String nestedPath; | ||
private final boolean acceptsKnnClause; | ||
|
||
private final Class<? extends ElasticsearchSearchPredicate> predicateType; | ||
|
||
public static PredicateNestingContext acceptsKnn() { | ||
return ACCEPTS_KNN; | ||
} | ||
|
||
public static PredicateNestingContext doesNotAcceptKnn() { | ||
return DOES_NOT_ACCEPT_KNN; | ||
} | ||
|
||
public static PredicateNestingContext nested(String nestedPath) { | ||
return new PredicateNestingContext( nestedPath ); | ||
} | ||
|
||
private PredicateNestingContext(String nestedPath, boolean acceptsKnnClause) { | ||
this( nestedPath, acceptsKnnClause, null ); | ||
} | ||
|
||
private PredicateNestingContext(String nestedPath, boolean acceptsKnnClause, | ||
Class<? extends ElasticsearchSearchPredicate> predicateType) { | ||
this.nestedPath = nestedPath; | ||
this.acceptsKnnClause = acceptsKnnClause; | ||
this.predicateType = predicateType; | ||
} | ||
|
||
private PredicateNestingContext(String nestedPath) { | ||
this( nestedPath, false ); | ||
} | ||
|
||
private PredicateNestingContext(boolean acceptsKnnClause) { | ||
this( null, acceptsKnnClause ); | ||
} | ||
|
||
public String getNestedPath() { | ||
return nestedPath; | ||
} | ||
|
||
public boolean acceptsKnnClause() { | ||
return acceptsKnnClause; | ||
} | ||
|
||
public PredicateNestingContext wrap(ElasticsearchSearchPredicate elasticsearchSearchPredicate) { | ||
return new PredicateNestingContext( | ||
nestedPath, | ||
acceptsKnnClause && this.predicateType == null, | ||
elasticsearchSearchPredicate.getClass() | ||
); | ||
} | ||
} |
Oops, something went wrong.