This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:oxm="http://www.springframework.org/schema/oxm" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans.xsd | |
http://www.springframework.org/schema/oxm | |
http://www.springframework.org/schema/oxm/spring-oxm.xsd"> | |
<oxm:jaxb2-marshaller id="marshaller"> |
This file contains hidden or 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
@XmlSchema( | |
xmlns = { | |
@XmlNs(prefix = "bb", namespaceURI ="http://www.backbase.com/ns/widgets"), | |
}, | |
elementFormDefault = XmlNsForm.QUALIFIED | |
) | |
package com.za.jaxb.widget; | |
import javax.xml.bind.annotation.XmlNs; | |
import javax.xml.bind.annotation.XmlNsForm; |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<bb:widget xmlns:bb="http://www.backbase.com/ns/widgets"> | |
<bb:resources> | |
<bb:resource type="text/css" src="css/wrap-layout.css"/> | |
<bb:resource type="text/javascript" src="template/wrap-layout.js"/> | |
<bb:resource type="image/png" src="png/wrap-layout.js"/> | |
</bb:resources> | |
</bb:widget> |
This file contains hidden or 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
GetResponse matchedQuery = client.prepareGet("households","_percolator", "myQuery") | |
.setFetchSource("user_id", "query") | |
.execute().actionGet(); | |
assertThat(((String) matchedQuery.getSource().get("user_id")), is("123")); | |
assertThat(matchedQuery.getSource().get("query"), is(nullValue())); |
This file contains hidden or 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
public class Household { | |
private String id; | |
private String description; | |
private Double lat; | |
private Double lon; | |
private int price; | |
private Date postDate; | |
} |
This file contains hidden or 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
// create a source of the percolate request | |
XContentBuilder docBuilder = jsonBuilder() | |
.startObject() | |
.field("doc") | |
.startObject() | |
.startObject("location") | |
.field("lat", 52.10) | |
.field("lon", 5.12) | |
.endObject() | |
.field("price", 290000) |
This file contains hidden or 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
client.prepareIndex("households", "_percolator", "myQuery") | |
.setSource(jsonBuilder() | |
.startObject() | |
.field("query", constantScoreQuery(filterBuilder())) | |
.field("user_id", "123") | |
.endObject()) | |
.setRefresh(true) // Needed when the query shall be available immediately | |
.execute().actionGet(); |
This file contains hidden or 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
private FilterBuilder filterBuilder() { | |
return boolFilter() | |
.must(rangeFilter("price").from("250000").to("300000")) | |
.must(geoDistanceFilter("location") | |
.point(52.09, 5.11) | |
.distance(5, DistanceUnit.KILOMETERS) | |
); | |
} |
This file contains hidden or 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
private void addGeoTypeMapping() throws IOException { | |
XContentBuilder mapping = jsonBuilder() | |
.startObject() | |
.startObject("household") | |
.startObject("properties") | |
.startObject("location") | |
.field("type", "geo_point") | |
.endObject() | |
.endObject() | |
.endObject() |
This file contains hidden or 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
package com.za.spring.fun.mixconfig; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.ImportResource; | |
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | |
/** | |
* Java and XML based repository configuration. | |
* | |
* @author Zoltan Altfatter |