Skip to content

Commit

Permalink
Clean up and make all tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
kwahlin committed Dec 19, 2024
1 parent 32af60a commit 8d3fa03
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 36 deletions.
1 change: 0 additions & 1 deletion whelk-core/src/main/groovy/whelk/search2/Stats.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ private Map<String, Object> buildSliceByDimension(Map<Property, Map<PropertyValu
sliceNode.put("dimension", property.name());
sliceNode.put("observation", observations);
sliceNode.put("maxItems", sliceParamsByProperty.get(property).size());
// property.getAlias(queryTree.getOutsetType()).ifPresent(a -> sliceNode.put("alias", a));
sliceByDimension.put(property.name(), sliceNode);
}
});
Expand Down
4 changes: 0 additions & 4 deletions whelk-core/src/main/groovy/whelk/search2/querytree/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,4 @@ default Node reduceTypes(Disambiguate disambiguate) {
default boolean isTypeNode() {
return false;
}

default List<String> collectTypes(Disambiguate disambiguate) {
return List.of();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Map<String, Object> toEs() {

@Override
public Node expand(Disambiguate disambiguate, Collection<String> rulingTypes, Function<Collection<String>, Collection<String>> getBoostFields) {
throw new UnsupportedOperationException("");
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import static whelk.search2.Disambiguate.Rdfs.RESOURCE
class ActiveBoolFilterSpec extends Specification {
def "expand"() {
given:
def disambiguate = new Disambiguate(['vocab': [:]])
def outset = RESOURCE
def disambiguate = new Disambiguate([:])
def excludeA = new ActiveBoolFilter('excludeA', pathV1, [:])
def includeA = new ActiveBoolFilter('includeA', new InactiveBoolFilter('excludeA'), [:])

expect:
excludeA.expand(disambiguate, outset) == pathV1
includeA.expand(disambiguate, outset) == null
excludeA.expand(disambiguate, [], x -> []) == pathV1
includeA.expand(disambiguate, [], x -> []) == null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,32 +168,6 @@ class QueryTreeSpec extends Specification {
])
}

def "collect given types"() {
given:
def rdfType = new Property(RDF_TYPE)
QueryTree qt = new QueryTree(and([
propV(rdfType, eq, v1),
propV(rdfType, neq, v2),
or([pathV1, propV(rdfType, eq, v3)]),
]))

expect:
qt.collectRulingTypes() == [v1.string(), v3.string()] as Set
}

def "collect given types"() {
given:
def rdfType = new Property(RDF_TYPE)
QueryTree qt = new QueryTree(and([
propV(rdfType, eq, new VocabTerm('type1')),
propV(rdfType, neq, new VocabTerm('type2')),
or([pathV1, propV(rdfType, eq, new VocabTerm('type3'))]),
]))

expect:
qt.collectRulingTypes() == ['type1', 'type3'] as Set
}

def "get top level free text as string"() {
expect:
new QueryTree(tree).getTopLevelFreeText() == result
Expand Down

0 comments on commit 8d3fa03

Please sign in to comment.