Get content search working correctly
This commit is contained in:
parent
b97f7d4664
commit
6d93cbcaae
|
@ -800,8 +800,14 @@ public class JsonParser extends BaseParser implements IParser {
|
||||||
|
|
||||||
if (theResource instanceof IBaseBinary) {
|
if (theResource instanceof IBaseBinary) {
|
||||||
IBaseBinary bin = (IBaseBinary) theResource;
|
IBaseBinary bin = (IBaseBinary) theResource;
|
||||||
theEventWriter.write("contentType", bin.getContentType());
|
String contentType = bin.getContentType();
|
||||||
theEventWriter.write("content", bin.getContentAsBase64());
|
if (isNotBlank(contentType)) {
|
||||||
|
theEventWriter.write("contentType", contentType);
|
||||||
|
}
|
||||||
|
String contentAsBase64 = bin.getContentAsBase64();
|
||||||
|
if (isNotBlank(contentAsBase64)) {
|
||||||
|
theEventWriter.write("content", contentAsBase64);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, resDef, theContainedResource, new CompositeChildElement(resDef));
|
encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, resDef, theContainedResource, new CompositeChildElement(resDef));
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,10 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
import org.apache.http.client.utils.URLEncodedUtils;
|
import org.apache.http.client.utils.URLEncodedUtils;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import org.springframework.transaction.TransactionStatus;
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
@ -695,7 +697,11 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ResourceTag next : new ArrayList<ResourceTag>(theEntity.getTags())) {
|
ArrayList<ResourceTag> existingTags = new ArrayList<ResourceTag>();
|
||||||
|
if (theEntity.isHasTags()) {
|
||||||
|
existingTags.addAll(theEntity.getTags());
|
||||||
|
}
|
||||||
|
for (ResourceTag next : existingTags) {
|
||||||
TagDefinition nextDef = next.getTag();
|
TagDefinition nextDef = next.getTag();
|
||||||
if (!allDefs.contains(nextDef)) {
|
if (!allDefs.contains(nextDef)) {
|
||||||
if (shouldDroppedTagBeRemovedOnUpdate(theEntity, next)) {
|
if (shouldDroppedTagBeRemovedOnUpdate(theEntity, next)) {
|
||||||
|
@ -1224,23 +1230,38 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
theEntity.setVersion(theEntity.getVersion() + 1);
|
theEntity.setVersion(theEntity.getVersion() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean paramsStringPopulated = theEntity.isParamsStringPopulated();
|
Collection<ResourceIndexedSearchParamString> paramsString = new ArrayList<ResourceIndexedSearchParamString>();
|
||||||
boolean paramsTokenPopulated = theEntity.isParamsTokenPopulated();
|
if (theEntity.isParamsStringPopulated()) {
|
||||||
boolean paramsNumberPopulated = theEntity.isParamsNumberPopulated();
|
paramsString.addAll(theEntity.getParamsString());
|
||||||
boolean paramsQuantityPopulated = theEntity.isParamsQuantityPopulated();
|
}
|
||||||
boolean paramsDatePopulated = theEntity.isParamsDatePopulated();
|
Collection<ResourceIndexedSearchParamToken> paramsToken = new ArrayList<ResourceIndexedSearchParamToken>();
|
||||||
boolean paramsCoordsPopulated = theEntity.isParamsCoordsPopulated();
|
if (theEntity.isParamsTokenPopulated()) {
|
||||||
boolean paramsUriPopulated = theEntity.isParamsUriPopulated();
|
paramsToken.addAll(theEntity.getParamsToken());
|
||||||
boolean hasLinks = theEntity.isHasLinks();
|
}
|
||||||
|
Collection<ResourceIndexedSearchParamNumber> paramsNumber = new ArrayList<ResourceIndexedSearchParamNumber>();
|
||||||
Collection<ResourceIndexedSearchParamString> paramsString = new ArrayList<ResourceIndexedSearchParamString>(theEntity.getParamsString()); // TODO: use the isPopulated method to decide whether to call this
|
if (theEntity.isParamsNumberPopulated()) {
|
||||||
Collection<ResourceIndexedSearchParamToken> paramsToken = new ArrayList<ResourceIndexedSearchParamToken>(theEntity.getParamsToken());
|
paramsNumber.addAll(theEntity.getParamsNumber());
|
||||||
Collection<ResourceIndexedSearchParamNumber> paramsNumber = new ArrayList<ResourceIndexedSearchParamNumber>(theEntity.getParamsNumber());
|
}
|
||||||
Collection<ResourceIndexedSearchParamQuantity> paramsQuantity = new ArrayList<ResourceIndexedSearchParamQuantity>(theEntity.getParamsQuantity());
|
Collection<ResourceIndexedSearchParamQuantity> paramsQuantity = new ArrayList<ResourceIndexedSearchParamQuantity>();
|
||||||
Collection<ResourceIndexedSearchParamDate> paramsDate = new ArrayList<ResourceIndexedSearchParamDate>(theEntity.getParamsDate());
|
if (theEntity.isParamsQuantityPopulated()) {
|
||||||
Collection<ResourceIndexedSearchParamUri> paramsUri = new ArrayList<ResourceIndexedSearchParamUri>(theEntity.getParamsUri());
|
paramsQuantity.addAll(theEntity.getParamsQuantity());
|
||||||
Collection<ResourceIndexedSearchParamCoords> paramsCoords = new ArrayList<ResourceIndexedSearchParamCoords>(theEntity.getParamsCoords());
|
}
|
||||||
Collection<ResourceLink> resourceLinks = new ArrayList<ResourceLink>(theEntity.getResourceLinks());
|
Collection<ResourceIndexedSearchParamDate> paramsDate = new ArrayList<ResourceIndexedSearchParamDate>();
|
||||||
|
if (theEntity.isParamsDatePopulated()) {
|
||||||
|
paramsDate.addAll(theEntity.getParamsDate());
|
||||||
|
}
|
||||||
|
Collection<ResourceIndexedSearchParamUri> paramsUri = new ArrayList<ResourceIndexedSearchParamUri>();
|
||||||
|
if (theEntity.isParamsUriPopulated()) {
|
||||||
|
paramsUri.addAll(theEntity.getParamsUri());
|
||||||
|
}
|
||||||
|
Collection<ResourceIndexedSearchParamCoords> paramsCoords = new ArrayList<ResourceIndexedSearchParamCoords>();
|
||||||
|
if (theEntity.isParamsCoordsPopulated()) {
|
||||||
|
paramsCoords.addAll(theEntity.getParamsCoords());
|
||||||
|
}
|
||||||
|
Collection<ResourceLink> resourceLinks = new ArrayList<ResourceLink>();
|
||||||
|
if (theEntity.isHasLinks()) {
|
||||||
|
resourceLinks.addAll(theEntity.getResourceLinks());
|
||||||
|
}
|
||||||
|
|
||||||
Set<ResourceIndexedSearchParamString> stringParams = null;
|
Set<ResourceIndexedSearchParamString> stringParams = null;
|
||||||
Set<ResourceIndexedSearchParamToken> tokenParams = null;
|
Set<ResourceIndexedSearchParamToken> tokenParams = null;
|
||||||
|
@ -1264,6 +1285,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
theEntity.setDeleted(theDeletedTimestampOrNull);
|
theEntity.setDeleted(theDeletedTimestampOrNull);
|
||||||
theEntity.setUpdated(theDeletedTimestampOrNull);
|
theEntity.setUpdated(theDeletedTimestampOrNull);
|
||||||
theEntity.setNarrativeTextParsedIntoWords(null);
|
theEntity.setNarrativeTextParsedIntoWords(null);
|
||||||
|
theEntity.setContentTextParsedIntoWords(null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1313,6 +1335,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
theEntity.setHasLinks(links.isEmpty() == false);
|
theEntity.setHasLinks(links.isEmpty() == false);
|
||||||
theEntity.setIndexStatus(INDEX_STATUS_INDEXED);
|
theEntity.setIndexStatus(INDEX_STATUS_INDEXED);
|
||||||
theEntity.setNarrativeTextParsedIntoWords(parseNarrativeTextIntoWords(theResource));
|
theEntity.setNarrativeTextParsedIntoWords(parseNarrativeTextIntoWords(theResource));
|
||||||
|
theEntity.setContentTextParsedIntoWords(parseContentTextIntoWords(theResource));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1342,83 +1365,69 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
|
|
||||||
if (thePerformIndexing) {
|
if (thePerformIndexing) {
|
||||||
|
|
||||||
if (paramsStringPopulated) {
|
|
||||||
for (ResourceIndexedSearchParamString next : paramsString) {
|
for (ResourceIndexedSearchParamString next : paramsString) {
|
||||||
myEntityManager.remove(next);
|
myEntityManager.remove(next);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (ResourceIndexedSearchParamString next : stringParams) {
|
for (ResourceIndexedSearchParamString next : stringParams) {
|
||||||
myEntityManager.persist(next);
|
myEntityManager.persist(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paramsTokenPopulated) {
|
|
||||||
for (ResourceIndexedSearchParamToken next : paramsToken) {
|
for (ResourceIndexedSearchParamToken next : paramsToken) {
|
||||||
myEntityManager.remove(next);
|
myEntityManager.remove(next);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (ResourceIndexedSearchParamToken next : tokenParams) {
|
for (ResourceIndexedSearchParamToken next : tokenParams) {
|
||||||
myEntityManager.persist(next);
|
myEntityManager.persist(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paramsNumberPopulated) {
|
|
||||||
for (ResourceIndexedSearchParamNumber next : paramsNumber) {
|
for (ResourceIndexedSearchParamNumber next : paramsNumber) {
|
||||||
myEntityManager.remove(next);
|
myEntityManager.remove(next);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (ResourceIndexedSearchParamNumber next : numberParams) {
|
for (ResourceIndexedSearchParamNumber next : numberParams) {
|
||||||
myEntityManager.persist(next);
|
myEntityManager.persist(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paramsQuantityPopulated) {
|
|
||||||
for (ResourceIndexedSearchParamQuantity next : paramsQuantity) {
|
for (ResourceIndexedSearchParamQuantity next : paramsQuantity) {
|
||||||
myEntityManager.remove(next);
|
myEntityManager.remove(next);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (ResourceIndexedSearchParamQuantity next : quantityParams) {
|
for (ResourceIndexedSearchParamQuantity next : quantityParams) {
|
||||||
myEntityManager.persist(next);
|
myEntityManager.persist(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store date SP's
|
// Store date SP's
|
||||||
if (paramsDatePopulated) {
|
|
||||||
for (ResourceIndexedSearchParamDate next : paramsDate) {
|
for (ResourceIndexedSearchParamDate next : paramsDate) {
|
||||||
myEntityManager.remove(next);
|
myEntityManager.remove(next);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (ResourceIndexedSearchParamDate next : dateParams) {
|
for (ResourceIndexedSearchParamDate next : dateParams) {
|
||||||
myEntityManager.persist(next);
|
myEntityManager.persist(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store URI SP's
|
// Store URI SP's
|
||||||
if (paramsUriPopulated) {
|
|
||||||
for (ResourceIndexedSearchParamUri next : paramsUri) {
|
for (ResourceIndexedSearchParamUri next : paramsUri) {
|
||||||
myEntityManager.remove(next);
|
myEntityManager.remove(next);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (ResourceIndexedSearchParamUri next : uriParams) {
|
for (ResourceIndexedSearchParamUri next : uriParams) {
|
||||||
myEntityManager.persist(next);
|
myEntityManager.persist(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store Coords SP's
|
// Store Coords SP's
|
||||||
if (paramsCoordsPopulated) {
|
|
||||||
for (ResourceIndexedSearchParamCoords next : paramsCoords) {
|
for (ResourceIndexedSearchParamCoords next : paramsCoords) {
|
||||||
myEntityManager.remove(next);
|
myEntityManager.remove(next);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (ResourceIndexedSearchParamCoords next : coordsParams) {
|
for (ResourceIndexedSearchParamCoords next : coordsParams) {
|
||||||
myEntityManager.persist(next);
|
myEntityManager.persist(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasLinks) {
|
|
||||||
for (ResourceLink next : resourceLinks) {
|
for (ResourceLink next : resourceLinks) {
|
||||||
myEntityManager.remove(next);
|
myEntityManager.remove(next);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (ResourceLink next : links) {
|
for (ResourceLink next : links) {
|
||||||
myEntityManager.persist(next);
|
myEntityManager.persist(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // if thePerformIndexing
|
} // if thePerformIndexing
|
||||||
|
|
||||||
|
theEntity = myEntityManager.merge(theEntity);
|
||||||
|
|
||||||
myEntityManager.flush();
|
myEntityManager.flush();
|
||||||
|
|
||||||
if (theResource != null) {
|
if (theResource != null) {
|
||||||
|
@ -1502,4 +1511,20 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String parseContentTextIntoWords(IResource theResource) {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
List<IPrimitiveType> childElements = getContext().newTerser().getAllPopulatedChildElementsOfType(theResource, IPrimitiveType.class);
|
||||||
|
for (@SuppressWarnings("rawtypes") IPrimitiveType nextType : childElements) {
|
||||||
|
String nextValue = nextType.getValueAsString();
|
||||||
|
if (isNotBlank(nextValue)) {
|
||||||
|
if (b.length() > 0 && b.charAt(b.length() - 1) != ' ') {
|
||||||
|
b.append(' ');
|
||||||
|
}
|
||||||
|
b.append(nextValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class FhirSearchDao extends BaseHapiFhirDao<IBaseResource> implements ISe
|
||||||
BooleanJunction<?> bool = qb.bool();
|
BooleanJunction<?> bool = qb.bool();
|
||||||
|
|
||||||
List<List<? extends IQueryParameterType>> contentAndTerms = theParams.remove(Constants.PARAM_CONTENT);
|
List<List<? extends IQueryParameterType>> contentAndTerms = theParams.remove(Constants.PARAM_CONTENT);
|
||||||
addTextSearch(qb, bool, contentAndTerms, "myParamsString.myValueComplete");
|
addTextSearch(qb, bool, contentAndTerms, "myContentText");
|
||||||
|
|
||||||
List<List<? extends IQueryParameterType>> textAndTerms = theParams.remove(Constants.PARAM_TEXT);
|
List<List<? extends IQueryParameterType>> textAndTerms = theParams.remove(Constants.PARAM_TEXT);
|
||||||
addTextSearch(qb, bool, textAndTerms, "myNarrativeText");
|
addTextSearch(qb, bool, textAndTerms, "myNarrativeText");
|
||||||
|
|
|
@ -30,6 +30,7 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.MappedSuperclass;
|
import javax.persistence.MappedSuperclass;
|
||||||
|
|
||||||
|
import org.hibernate.search.annotations.ContainedIn;
|
||||||
import org.hibernate.search.annotations.Field;
|
import org.hibernate.search.annotations.Field;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
|
@ -50,6 +51,7 @@ public abstract class BaseResourceIndexedSearchParam implements Serializable {
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
@JoinColumn(name = "RES_ID", referencedColumnName="RES_ID")
|
@JoinColumn(name = "RES_ID", referencedColumnName="RES_ID")
|
||||||
|
@ContainedIn
|
||||||
private ResourceTable myResource;
|
private ResourceTable myResource;
|
||||||
|
|
||||||
@Field
|
@Field
|
||||||
|
|
|
@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
|
@ -31,6 +32,7 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@Embeddable
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_HISTORY_TAG")
|
@Table(name = "HFJ_HISTORY_TAG")
|
||||||
public class ResourceHistoryTag extends BaseTag implements Serializable {
|
public class ResourceHistoryTag extends BaseTag implements Serializable {
|
||||||
|
|
|
@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@ -29,9 +30,9 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import org.hibernate.search.annotations.Field;
|
import org.hibernate.search.annotations.Field;
|
||||||
import org.hibernate.search.annotations.Indexed;
|
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
|
@Embeddable
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_SPIDX_COORDS" /* , indexes = { @Index(name = "IDX_SP_TOKEN", columnList = "SP_SYSTEM,SP_VALUE") } */)
|
@Table(name = "HFJ_SPIDX_COORDS" /* , indexes = { @Index(name = "IDX_SP_TOKEN", columnList = "SP_SYSTEM,SP_VALUE") } */)
|
||||||
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_COORDS", indexes = {
|
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_COORDS", indexes = {
|
||||||
|
|
|
@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
|
@ -33,9 +34,9 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import org.hibernate.search.annotations.Field;
|
import org.hibernate.search.annotations.Field;
|
||||||
import org.hibernate.search.annotations.Indexed;
|
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
|
@Embeddable
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_SPIDX_DATE" /*, indexes= {@Index(name="IDX_SP_DATE", columnList= "SP_VALUE_LOW,SP_VALUE_HIGH")}*/)
|
@Table(name = "HFJ_SPIDX_DATE" /*, indexes= {@Index(name="IDX_SP_DATE", columnList= "SP_VALUE_LOW,SP_VALUE_HIGH")}*/)
|
||||||
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_DATE", indexes= {
|
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_DATE", indexes= {
|
||||||
|
|
|
@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ import org.hibernate.search.annotations.NumericField;
|
||||||
import ca.uhn.fhir.jpa.util.BigDecimalNumericFieldBridge;
|
import ca.uhn.fhir.jpa.util.BigDecimalNumericFieldBridge;
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
|
@Embeddable
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_SPIDX_NUMBER" /*, indexes= {@Index(name="IDX_SP_NUMBER", columnList="SP_VALUE")}*/ )
|
@Table(name = "HFJ_SPIDX_NUMBER" /*, indexes= {@Index(name="IDX_SP_NUMBER", columnList="SP_VALUE")}*/ )
|
||||||
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_NUMBER", indexes= {
|
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_NUMBER", indexes= {
|
||||||
|
|
|
@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ import org.hibernate.search.annotations.NumericField;
|
||||||
import ca.uhn.fhir.jpa.util.BigDecimalNumericFieldBridge;
|
import ca.uhn.fhir.jpa.util.BigDecimalNumericFieldBridge;
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
|
@Embeddable
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_SPIDX_QUANTITY" /*, indexes= {@Index(name="IDX_SP_NUMBER", columnList="SP_VALUE")}*/ )
|
@Table(name = "HFJ_SPIDX_QUANTITY" /*, indexes= {@Index(name="IDX_SP_NUMBER", columnList="SP_VALUE")}*/ )
|
||||||
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_QUANTITY", indexes= {
|
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_QUANTITY", indexes= {
|
||||||
|
|
|
@ -21,7 +21,10 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -29,9 +32,10 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import org.hibernate.search.annotations.ContainedIn;
|
||||||
import org.hibernate.search.annotations.Field;
|
import org.hibernate.search.annotations.Field;
|
||||||
import org.hibernate.search.annotations.Indexed;
|
|
||||||
|
|
||||||
|
@Embeddable
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_SPIDX_STRING"/* , indexes= {@Index(name="IDX_SP_STRING", columnList="SP_VALUE_NORMALIZED")} */)
|
@Table(name = "HFJ_SPIDX_STRING"/* , indexes= {@Index(name="IDX_SP_STRING", columnList="SP_VALUE_NORMALIZED")} */)
|
||||||
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_STRING", indexes = {
|
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_STRING", indexes = {
|
||||||
|
@ -49,9 +53,11 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP
|
||||||
@Column(name = "SP_VALUE_NORMALIZED", length = MAX_LENGTH, nullable = true)
|
@Column(name = "SP_VALUE_NORMALIZED", length = MAX_LENGTH, nullable = true)
|
||||||
private String myValueNormalized;
|
private String myValueNormalized;
|
||||||
|
|
||||||
@Column(name="SP_VALUE_EXACT", insertable=false, updatable=false)
|
@ManyToOne(optional = false)
|
||||||
@Field
|
@JoinColumn(name = "RES_ID", referencedColumnName="RES_ID", insertable=false, updatable=false)
|
||||||
private String myValueComplete;
|
@ContainedIn
|
||||||
|
private ResourceTable myResourceTable;
|
||||||
|
|
||||||
|
|
||||||
public ResourceIndexedSearchParamString() {
|
public ResourceIndexedSearchParamString() {
|
||||||
}
|
}
|
||||||
|
@ -103,7 +109,6 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP
|
||||||
throw new IllegalArgumentException("Value is too long: " + theValueExact.length());
|
throw new IllegalArgumentException("Value is too long: " + theValueExact.length());
|
||||||
}
|
}
|
||||||
myValueExact = theValueExact;
|
myValueExact = theValueExact;
|
||||||
myValueComplete = theValueExact;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValueNormalized(String theValueNormalized) {
|
public void setValueNormalized(String theValueNormalized) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import org.hibernate.search.annotations.Field;
|
import org.hibernate.search.annotations.Field;
|
||||||
import org.hibernate.search.annotations.Indexed;
|
import org.hibernate.search.annotations.Indexed;
|
||||||
|
|
||||||
|
@Embeddable
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_SPIDX_TOKEN" /* , indexes = { @Index(name = "IDX_SP_TOKEN", columnList = "SP_SYSTEM,SP_VALUE") } */)
|
@Table(name = "HFJ_SPIDX_TOKEN" /* , indexes = { @Index(name = "IDX_SP_TOKEN", columnList = "SP_SYSTEM,SP_VALUE") } */)
|
||||||
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_TOKEN", indexes = { @org.hibernate.annotations.Index(name = "IDX_SP_TOKEN", columnNames = { "RES_TYPE", "SP_NAME", "SP_SYSTEM", "SP_VALUE" }),
|
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_TOKEN", indexes = { @org.hibernate.annotations.Index(name = "IDX_SP_TOKEN", columnNames = { "RES_TYPE", "SP_NAME", "SP_SYSTEM", "SP_VALUE" }),
|
||||||
|
|
|
@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ import org.hibernate.search.annotations.Field;
|
||||||
import org.hibernate.search.annotations.Indexed;
|
import org.hibernate.search.annotations.Indexed;
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
|
@Embeddable
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_SPIDX_URI" /* , indexes = { @Index(name = "IDX_SP_TOKEN", columnList = "SP_SYSTEM,SP_VALUE") } */)
|
@Table(name = "HFJ_SPIDX_URI" /* , indexes = { @Index(name = "IDX_SP_TOKEN", columnList = "SP_SYSTEM,SP_VALUE") } */)
|
||||||
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_URI", indexes = {
|
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_URI", indexes = {
|
||||||
|
|
|
@ -49,7 +49,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
@Indexed(interceptor=IndexNonDeletedInterceptor.class)
|
@Indexed(/*interceptor=IndexNonDeletedInterceptor.class*/)
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "HFJ_RESOURCE", uniqueConstraints = {}, indexes= {
|
@Table(name = "HFJ_RESOURCE", uniqueConstraints = {}, indexes= {
|
||||||
@Index(name = "IDX_RES_DATE", columnList="RES_UPDATED"),
|
@Index(name = "IDX_RES_DATE", columnList="RES_UPDATED"),
|
||||||
|
@ -86,55 +86,56 @@ public class ResourceTable extends BaseHasResource implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Holds the narrative text only - Used for Fulltext searching but not directly stored in the DB
|
* Holds the narrative text only - Used for Fulltext searching but not directly stored in the DB
|
||||||
*/
|
*/
|
||||||
@Column(name = "SP_NARRATIVE_TEXT", length = Integer.MAX_VALUE - 1)
|
@Column(name = "SP_NARRATIVE_TEXT", length = Integer.MAX_VALUE - 1, nullable=true)
|
||||||
@Lob
|
@Lob
|
||||||
@Field()
|
@Field()
|
||||||
private String myNarrativeText;
|
private String myNarrativeText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the narrative text only - Used for Fulltext searching but not directly stored in the DB
|
||||||
|
*/
|
||||||
|
@Column(name = "SP_CONTENT_TEXT", length = Integer.MAX_VALUE - 1, nullable=true)
|
||||||
|
@Lob
|
||||||
|
@Field()
|
||||||
|
private String myContentText;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
||||||
@IndexedEmbedded
|
|
||||||
private Collection<ResourceIndexedSearchParamCoords> myParamsCoords;
|
private Collection<ResourceIndexedSearchParamCoords> myParamsCoords;
|
||||||
|
|
||||||
@Column(name = "SP_COORDS_PRESENT")
|
@Column(name = "SP_COORDS_PRESENT")
|
||||||
private boolean myParamsCoordsPopulated;
|
private boolean myParamsCoordsPopulated;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
||||||
@IndexedEmbedded
|
|
||||||
private Collection<ResourceIndexedSearchParamDate> myParamsDate;
|
private Collection<ResourceIndexedSearchParamDate> myParamsDate;
|
||||||
|
|
||||||
@Column(name = "SP_DATE_PRESENT")
|
@Column(name = "SP_DATE_PRESENT")
|
||||||
private boolean myParamsDatePopulated;
|
private boolean myParamsDatePopulated;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
||||||
@IndexedEmbedded
|
|
||||||
private Collection<ResourceIndexedSearchParamNumber> myParamsNumber;
|
private Collection<ResourceIndexedSearchParamNumber> myParamsNumber;
|
||||||
|
|
||||||
@Column(name = "SP_NUMBER_PRESENT")
|
@Column(name = "SP_NUMBER_PRESENT")
|
||||||
private boolean myParamsNumberPopulated;
|
private boolean myParamsNumberPopulated;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
||||||
@IndexedEmbedded
|
|
||||||
private Collection<ResourceIndexedSearchParamQuantity> myParamsQuantity;
|
private Collection<ResourceIndexedSearchParamQuantity> myParamsQuantity;
|
||||||
|
|
||||||
@Column(name = "SP_QUANTITY_PRESENT")
|
@Column(name = "SP_QUANTITY_PRESENT")
|
||||||
private boolean myParamsQuantityPopulated;
|
private boolean myParamsQuantityPopulated;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
||||||
@IndexedEmbedded
|
|
||||||
private Collection<ResourceIndexedSearchParamString> myParamsString;
|
private Collection<ResourceIndexedSearchParamString> myParamsString;
|
||||||
|
|
||||||
@Column(name = "SP_STRING_PRESENT")
|
@Column(name = "SP_STRING_PRESENT")
|
||||||
private boolean myParamsStringPopulated;
|
private boolean myParamsStringPopulated;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
||||||
@IndexedEmbedded
|
|
||||||
private Collection<ResourceIndexedSearchParamToken> myParamsToken;
|
private Collection<ResourceIndexedSearchParamToken> myParamsToken;
|
||||||
|
|
||||||
@Column(name = "SP_TOKEN_PRESENT")
|
@Column(name = "SP_TOKEN_PRESENT")
|
||||||
private boolean myParamsTokenPopulated;
|
private boolean myParamsTokenPopulated;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
|
||||||
@IndexedEmbedded
|
|
||||||
private Collection<ResourceIndexedSearchParamUri> myParamsUri;
|
private Collection<ResourceIndexedSearchParamUri> myParamsUri;
|
||||||
|
|
||||||
@Column(name = "SP_URI_PRESENT")
|
@Column(name = "SP_URI_PRESENT")
|
||||||
|
@ -324,6 +325,10 @@ public class ResourceTable extends BaseHasResource implements Serializable {
|
||||||
myNarrativeText = theNarrativeText;
|
myNarrativeText = theNarrativeText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setContentTextParsedIntoWords(String theContentText) {
|
||||||
|
myContentText = theContentText;
|
||||||
|
}
|
||||||
|
|
||||||
public void setParamsCoords(Collection<ResourceIndexedSearchParamCoords> theParamsCoords) {
|
public void setParamsCoords(Collection<ResourceIndexedSearchParamCoords> theParamsCoords) {
|
||||||
if (!isParamsTokenPopulated() && theParamsCoords.isEmpty()) {
|
if (!isParamsTokenPopulated() && theParamsCoords.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -447,9 +452,11 @@ public class ResourceTable extends BaseHasResource implements Serializable {
|
||||||
retVal.setDeleted(getDeleted());
|
retVal.setDeleted(getDeleted());
|
||||||
retVal.setForcedId(getForcedId());
|
retVal.setForcedId(getForcedId());
|
||||||
|
|
||||||
|
if (isHasTags()) {
|
||||||
for (ResourceTag next : getTags()) {
|
for (ResourceTag next : getTags()) {
|
||||||
retVal.addTag(next);
|
retVal.addTag(next);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,6 @@ public class IndexNonDeletedInterceptor implements EntityIndexingInterceptor<Res
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IndexingOverride onCollectionUpdate(ResourceTable entity) {
|
public IndexingOverride onCollectionUpdate(ResourceTable entity) {
|
||||||
return onUpdate(entity);
|
return IndexingOverride.APPLY_DEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
package ca.uhn.fhir.jpa.dao;
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.contains;
|
||||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
|
import static org.hamcrest.Matchers.empty;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -32,6 +34,53 @@ public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test {
|
||||||
ftem.flushToIndexes();
|
ftem.flushToIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchAndReindex() {
|
||||||
|
Patient patient;
|
||||||
|
SearchParameterMap map;
|
||||||
|
|
||||||
|
patient = new Patient();
|
||||||
|
patient.getText().setDiv("<div>DIVAAA</div>");
|
||||||
|
patient.addName().addGiven("NAMEAAA");
|
||||||
|
IIdType pId1 = myPatientDao.create(patient).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.add(Constants.PARAM_CONTENT, new StringParam("NAMEAAA"));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), contains(pId1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.add(Constants.PARAM_TEXT, new StringParam("DIVAAA"));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), contains(pId1));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reindex
|
||||||
|
*/
|
||||||
|
|
||||||
|
patient = new Patient();
|
||||||
|
patient.setId(pId1);
|
||||||
|
patient.getText().setDiv("<div>DIVBBB</div>");
|
||||||
|
patient.addName().addGiven("NAMEBBB");
|
||||||
|
myPatientDao.update(patient);
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.add(Constants.PARAM_CONTENT, new StringParam("NAMEAAA"));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), empty());
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.add(Patient.SP_NAME, new StringParam("NAMEBBB"));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), contains(pId1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.add(Constants.PARAM_CONTENT, new StringParam("NAMEBBB"));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), contains(pId1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.add(Constants.PARAM_TEXT, new StringParam("DIVBBB"));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), contains(pId1));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchWithChainedParams() {
|
public void testSearchWithChainedParams() {
|
||||||
String methodName = "testSearchWithChainedParams";
|
String methodName = "testSearchWithChainedParams";
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<property name="hibernate.cache.use_structured_entries" value="false" />
|
<property name="hibernate.cache.use_structured_entries" value="false" />
|
||||||
<property name="hibernate.search.default.directory_provider" value="filesystem"/>
|
<property name="hibernate.search.default.directory_provider" value="filesystem"/>
|
||||||
<property name="hibernate.search.default.indexBase" value="./target/lucene_indexes"/>
|
<property name="hibernate.search.default.indexBase" value="./target/lucene_indexes"/>
|
||||||
<entry key="hibernate.search.lucene_version" value="LUCENE_CURRENT" />
|
<property name="hibernate.search.lucene_version" value="LUCENE_CURRENT" />
|
||||||
<!--
|
<!--
|
||||||
<property name="hibernate.ejb.naming_strategy" value="ca.uhn.fhir.jpa.util.CustomNamingStrategy" />
|
<property name="hibernate.ejb.naming_strategy" value="ca.uhn.fhir.jpa.util.CustomNamingStrategy" />
|
||||||
-->
|
-->
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
<entry key="hibernate.cache.use_second_level_cache" value="false" />
|
<entry key="hibernate.cache.use_second_level_cache" value="false" />
|
||||||
<entry key="hibernate.cache.use_structured_entries" value="false" />
|
<entry key="hibernate.cache.use_structured_entries" value="false" />
|
||||||
<entry key="hibernate.search.default.directory_provider" value="filesystem" />
|
<entry key="hibernate.search.default.directory_provider" value="filesystem" />
|
||||||
<entry key="hibernate.search.default.indexBase" value="#{systemProperties['fhir.lucene.location.dstu2']};" />
|
<entry key="hibernate.search.default.indexBase" value="#{systemProperties['fhir.lucene.location.dstu2']}" />
|
||||||
<entry key="hibernate.search.lucene_version" value="LUCENE_CURRENT" />
|
<entry key="hibernate.search.lucene_version" value="LUCENE_CURRENT" />
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
classpath:hapi-fhir-server-resourceproviders-dstu1.xml
|
classpath:hapi-fhir-server-resourceproviders-dstu1.xml
|
||||||
classpath:hapi-fhir-server-resourceproviders-dstu2.xml
|
classpath:hapi-fhir-server-resourceproviders-dstu2.xml
|
||||||
classpath:fhir-spring-subscription-config-dstu2.xml
|
classpath:fhir-spring-subscription-config-dstu2.xml
|
||||||
|
classpath:fhir-spring-search-config-dstu2.xml
|
||||||
</param-value>
|
</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,13 @@ public class JsonParserDstu2Test {
|
||||||
assertThat(encoded, containsString("\"div\":\"" + expected.replace("\"", "\\\"") + "\""));
|
assertThat(encoded, containsString("\"div\":\"" + expected.replace("\"", "\\\"") + "\""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEncodeEmptyBinary() {
|
||||||
|
String output = ourCtx.newJsonParser().encodeResourceToString(new Binary());
|
||||||
|
assertEquals("{\"resourceType\":\"Binary\"}", output);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamespacePreservationParse() throws Exception {
|
public void testNamespacePreservationParse() throws Exception {
|
||||||
String input = "{\"resourceType\":\"Patient\",\"text\":{\"div\":\"<xhtml:div xmlns:xhtml=\\\"http://www.w3.org/1999/xhtml\\\"><xhtml:img src=\\\"foo\\\"/>@fhirabend</xhtml:div>\"}}";
|
String input = "{\"resourceType\":\"Patient\",\"text\":{\"div\":\"<xhtml:div xmlns:xhtml=\\\"http://www.w3.org/1999/xhtml\\\"><xhtml:img src=\\\"foo\\\"/>@fhirabend</xhtml:div>\"}}";
|
||||||
|
|
|
@ -124,6 +124,13 @@ public class XmlParserDstu2Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEncodeEmptyBinary() {
|
||||||
|
String output = ourCtx.newXmlParser().encodeResourceToString(new Binary());
|
||||||
|
assertEquals("<Binary xmlns=\"http://hl7.org/fhir\"/>", output);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContainedResourceInExtensionUndeclared() {
|
public void testContainedResourceInExtensionUndeclared() {
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
|
|
|
@ -170,6 +170,10 @@
|
||||||
number of unneeded dependencies. Thanks to Thomas Andersen
|
number of unneeded dependencies. Thanks to Thomas Andersen
|
||||||
for the pull request!
|
for the pull request!
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
Fix a crash when encoding a Binary resource in JSON encoding
|
||||||
|
if the resource has no content-type
|
||||||
|
</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="1.2" date="2015-09-18">
|
<release version="1.2" date="2015-09-18">
|
||||||
<action type="add">
|
<action type="add">
|
||||||
|
|
Loading…
Reference in New Issue