forked from halo-dev/halo
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
22 changed files
with
277 additions
and
437 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
27 changes: 27 additions & 0 deletions
27
api/src/main/java/run/halo/app/extension/index/query/Not.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,27 @@ | ||
package run.halo.app.extension.index.query; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import java.util.Collections; | ||
import java.util.NavigableSet; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class Not extends LogicalQuery { | ||
|
||
private final Query negatedQuery; | ||
|
||
public Not(Query negatedQuery) { | ||
super(Collections.singleton( | ||
requireNonNull(negatedQuery, "The negated query must not be null."))); | ||
this.negatedQuery = negatedQuery; | ||
} | ||
|
||
@Override | ||
public NavigableSet<String> matches(QueryIndexView indexView) { | ||
var negatedResult = negatedQuery.matches(indexView); | ||
var allIds = indexView.getAllIds(); | ||
allIds.removeAll(negatedResult); | ||
return allIds; | ||
} | ||
} |
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
Oops, something went wrong.