Skip to content

Commit

Permalink
Merge #634 from branch 'lobid-resources-1846-removeGraphAtavism' of h…
Browse files Browse the repository at this point in the history
  • Loading branch information
dr0i committed Nov 7, 2023
2 parents 7968101 + ea379ab commit a69b8e2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 25 deletions.
7 changes: 2 additions & 5 deletions app/controllers/nwbib/Classification.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,8 @@ public static List<String> toJsonLd(final URL turtleUrl) {
*/
public static JsonNode ids(String q, String t) {
QueryBuilder queryBuilder = QueryBuilders.boolQuery()
.should(QueryBuilders.matchQuery(//
"@graph." + Property.LABEL.value + ".@value", q))
.should(QueryBuilders.idsQuery(Type.NWBIB.elasticsearchType,
Type.SPATIAL.elasticsearchType).ids(q))
.minimumNumberShouldMatch(1);
.must(QueryBuilders.idsQuery(Type.NWBIB.elasticsearchType,
Type.SPATIAL.elasticsearchType).ids(q));
SearchRequestBuilder requestBuilder = client.prepareSearch(INDEX)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(queryBuilder);
if (t.isEmpty()) {
Expand Down
3 changes: 1 addition & 2 deletions app/views/TableRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ private static String graphObjectLabelForId(String id, JsonNode doc,
return id;
}

List<JsonNode> graphs = doc.findValues("@graph");
for (JsonNode node : graphs.isEmpty() ? doc : graphs.get(0)) {
for (JsonNode node : doc) {
for (String key : labelKeys.get()) {
String idField = node.has("id") ? "id" : "@id";
if (node.has(key) && node.has(idField)
Expand Down
18 changes: 3 additions & 15 deletions app/views/tags/result_short.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,18 @@
@(id:String, doc: play.api.libs.json.JsValue, i: Int = -1, hits: Seq[String] = Seq())

@import play.api.libs.json._
@import views.TableRow
@import controllers.nwbib.Lobid
@import scala.collection.immutable.Map
@import play.mvc.Controller.session
@import play.cache.Cache
@import controllers.nwbib.Application

@optional(doc: JsValue, key: String, sep: String, alt: String)=@{
val other = (doc \\ key)
if(!other.isEmpty){
sep + other(0).asOpt[String].getOrElse(other(0).as[Seq[JsValue]].map(_.as[String]).mkString("; "))
val other = doc \\ key
if(other.nonEmpty){
sep + other.head.asOpt[String].getOrElse(other.head.as[Seq[JsValue]].map(_.as[String]).mkString("; "))
} else {alt}
}

@valueFor(doc: JsValue, id: String, keys: Seq[String]) = @{
val res = for (elem <- ((doc \\ "@graph").head).as[Seq[JsValue]]; key <- keys;
if ((elem \ "@id").as[String] == id && elem.as[Map[String, JsValue]].contains(key))
) yield {
val result = (elem \ key)
result.asOpt[String].getOrElse(result.toString)
}
if(res.isEmpty) id else res.get(0)
}

@icon_span(v: Seq[String], fullField: String) = {
<span title="@Html(Lobid.facetLabel(v,fullField,""))" class="@Lobid.facetIcon(v,fullField)"></span>
}
Expand Down
5 changes: 2 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ libraryDependencies ++= Seq(
"com.typesafe.play" % "play-test_2.11" % "2.4.11",
"org.elasticsearch" % "elasticsearch" % "1.7.5" withSources(),
"org.mockito" % "mockito-core" % "1.9.5",
"com.github.jsonld-java" % "jsonld-java" % "0.5.0",
"org.apache.commons" % "commons-rdf-jena" % "0.5.0",
"org.apache.commons" % "commons-csv" % "1.6",
"org.apache.jena" % "jena-arq" % "3.0.1",
"org.apache.jena" % "jena-core" % "3.0.1",
"org.apache.jena" % "jena-arq" % "3.17.0" exclude ("com.github.jsonld-java","jsonld-java"),
"org.apache.jena" % "jena-core" % "3.17.0",
"org.easytesting" % "fest-assert" % "1.4" % "test"
)

Expand Down
2 changes: 2 additions & 0 deletions test/tests/ExternalIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void setUp() throws Exception {
Http.Context.current.set(context);
}

@Ignore // https://github.com/hbz/nwbib/issues/633
@Test
public void testFacets() {
running(testServer(3333), () -> {
Expand Down Expand Up @@ -81,6 +82,7 @@ public void renderTemplate() {
});
}

@Ignore // https://github.com/hbz/nwbib/issues/633
@Test
public void sizeRequest() {
running(testServer(3333), () -> {
Expand Down

0 comments on commit a69b8e2

Please sign in to comment.