Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public BoolQueryBuilder buildBasicQuery(String queryTerm, String category) {
MultiMatchQueryBuilder multi = QueryBuilders.multiMatchQuery(queryTerm);
multi.field("symbol", 5.0F);
multi.field("symbol.keyword", 8.0F);
multi.field("name_key.autocomplete", 3.0F);
multi.field("nameKey.autocomplete", 3.0F);
multi.field("name.keyword", 2.0F);
multi.field("name.autocomplete");
Expand Down Expand Up @@ -77,11 +76,9 @@ public ArrayList<Map<String, Object>> formatResults(SearchResponse res) {
for (SearchHit hit: res.getHits()) {
String category = (String) hit.getSourceAsMap().get("category");

//this comes over from the Python code, use symbol for geneMap,
//seems like maybe it could also use name_key for everyone...
//this comes over from the Python code, use symbol for geneMap
if (StringUtils.equals(category, Category.GENE.getName())) {
hit.getSourceAsMap().put("name", hit.getSourceAsMap().get("symbol"));
hit.getSourceAsMap().put("name_key", hit.getSourceAsMap().get("nameKey"));
}
ret.add(hit.getSourceAsMap());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,13 @@ public FunctionScoreQueryBuilder.FilterFunctionBuilder[] buildBoostFunctions(Str
functionList.add(rnaBoost());
functionList.add(pseudogeneBoost());

functionList.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(matchQuery("name_key.keyword", q), ScoreFunctionBuilders.weightFactorFunction(1000F)));
functionList.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(matchQuery("nameKey.keyword", q), ScoreFunctionBuilders.weightFactorFunction(1000F)));

functionList.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(matchQuery("primaryKey", q), ScoreFunctionBuilders.weightFactorFunction(1000F)));
functionList.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(matchQuery("curie", q), ScoreFunctionBuilders.weightFactorFunction(1000F)));

functionList.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(matchQuery("name_key.keywordAutocomplete", q), ScoreFunctionBuilders.weightFactorFunction(500F)));
functionList.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(matchQuery("nameKey.keywordAutocomplete", q), ScoreFunctionBuilders.weightFactorFunction(500F)));

functionList.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(matchQuery("name_key.standardBigrams", q), ScoreFunctionBuilders.weightFactorFunction(500F)));
functionList.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(matchQuery("nameKey.standardBigrams", q), ScoreFunctionBuilders.weightFactorFunction(500F)));

functionList.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(matchQuery("species", q), ScoreFunctionBuilders.weightFactorFunction(2F)));
Expand Down Expand Up @@ -325,11 +322,7 @@ public void addRelatedDataLinks(Map<String, Object> result) {
if (result.containsKey("relatedData")) {
return;
}
String nameKey = (String) result.get("name_key");
// Gene documents use "name_key" (snake_case), GO search result documents use "nameKey" (camelCase)
if (nameKey == null) {
nameKey = (String) result.get("nameKey");
}
String nameKey = (String) result.get("nameKey");
// String name = (String) result.get("name");
String category = (String) result.get("category");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@ public List<String> getSearchFields() {
add("curie");
add("id");
add("localId");
add("name_key");
add("name_key.autocomplete");
add("name_key.htmlSmoosh");
add("name_key.keyword");
add("name_key.standardBigrams");
add("name_key.keywordAutocomplete");
add("nameKey");
add("nameKey.autocomplete");
add("nameKey.htmlSmoosh");
Expand Down Expand Up @@ -273,7 +267,7 @@ public List<String> getSearchFields() {
add("molecularConsequence");
add("molecularFunction");
add("name");
add("name_key");
add("nameKey");
add("nameKey");
add("primaryKey");
add("soTermName");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ class QueryRankIntegrationSpec extends Specification {

@Unroll
@Ignore
def "When querying for #query first result name_key should be #nameKey"() {
def "When querying for #query first result nameKey should be #nameKey"() {
when:
def encodedQuery = URLEncoder.encode(query, "UTF-8")
//todo: need to set the base search url in a nicer way
def results = ApiTester.getApiResults("/api/search?limit=50&offset=0&q=$encodedQuery")

def firstResultNameKey = results.first().get("name_key")
def firstResultNameKey = results.first().get("nameKey")

then:
results //should be some results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.alliancegenome.curation_api.model.document.es.AlleleSummaryDocument;
import org.alliancegenome.curation_api.model.entities.Allele;
import org.alliancegenome.curation_api.model.entities.Species;
import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm;
import org.alliancegenome.curation_api.model.entities.slotAnnotations.NameSlotAnnotation;
import org.alliancegenome.es.model.AlleleSearchResultDocument;
Expand Down Expand Up @@ -39,9 +40,17 @@ public List<AlleleSearchResultDocument> convert(List<AlleleSummaryDocument> alle

NCBITaxonTerm taxon = allele.getTaxon();
if (taxon != null) {
searchDoc.setSpecies(taxon.getName());
if (allele.getAlleleSymbol() != null) {
searchDoc.setNameKey(allele.getAlleleSymbol().getFormatText() + " (" + taxon.getName() + ")");
Species species = taxon.getSpecies();
if (species != null) {
searchDoc.setSpecies(species.getFullName());
if (allele.getAlleleSymbol() != null) {
searchDoc.setNameKey(allele.getAlleleSymbol().getFormatText() + " (" + species.getAbbreviation() + ")");
Comment thread
oblodgett marked this conversation as resolved.
}
} else {
searchDoc.setSpecies(taxon.getName());
if (allele.getAlleleSymbol() != null) {
searchDoc.setNameKey(allele.getAlleleSymbol().getFormatText() + " (" + taxon.getName() + ")");
}
}
} else if (allele.getAlleleSymbol() != null) {
searchDoc.setNameKey(allele.getAlleleSymbol().getFormatText());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class AutoCompleteDAO extends ESDAO {

private List<String> responseFields = Arrays.asList(
"name", "symbol", "curie", "primaryKey", "category", "go_type", "name_key", "nameKey"
"name", "symbol", "curie", "primaryKey", "category", "go_type", "nameKey"
);

public SearchResponse performQuery(QueryBuilder query) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.alliancegenome.es.index.site.doclet.CrossReferenceDoclet;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.Getter;
import lombok.Setter;
Expand All @@ -34,7 +33,6 @@ public class SearchableItemDocument extends ESDocument {
String href; //GO terms use this rather than modCrossRefCompleteUrl
String localId;
String name;
@JsonProperty("name_key")
String nameKey;
String nameText;
String modCrossRefCompleteUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ protected void buildSharedSearchableDocumentMappings() throws IOException {

new FieldBuilder(builder, "name", "text").symbol().autocomplete().keyword().keywordAutocomplete().htmlSmoosh().standardBigrams().build(); // allele, gene, model, go, dataset, disease
new FieldBuilder(builder, "nameText", "text").keyword().standardText().build(); // model
new FieldBuilder(builder, "name_key", "text").analyzer("symbols").autocomplete().keyword().keywordAutocomplete().htmlSmoosh().standardBigrams().build(); // allele, gene, model, dataset, disease
new FieldBuilder(builder, "nameKey", "text").analyzer("symbols").autocomplete().keyword().keywordAutocomplete().htmlSmoosh().standardBigrams().build(); // go_search_result
new FieldBuilder(builder, "nameKey", "text").analyzer("symbols").autocomplete().keyword().keywordAutocomplete().htmlSmoosh().standardBigrams().build(); // allele, gene, model, dataset, disease, go_search_result


new FieldBuilder(builder, "subject.alleleSymbol.displayText", "text").keyword().sort().build(); // allele_disease_annotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void buildMapping() {
builder.startObject("properties");
new FieldBuilder(builder, "category", "keyword").symbol().autocomplete().keyword().build();
new FieldBuilder(builder, "name", "keyword").build();
new FieldBuilder(builder, "name_key", "keyword").build();
new FieldBuilder(builder, "nameKey", "keyword").build();
new FieldBuilder(builder, "alterationType", "text").keyword().build();
new FieldBuilder(builder, "genes", "text").keyword().build();
new FieldBuilder(builder, "geneIds", "keyword").build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import org.alliancegenome.curation_api.model.document.es.ESDocument;
import org.alliancegenome.es.model.search.RelatedDataLink;

import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.Getter;
import lombok.Setter;

Expand All @@ -23,7 +21,6 @@ public AlleleSearchResultDocument() {
private String symbol;
private String symbolText;
private String name;
@JsonProperty("name_key")
private String nameKey;
private String primaryKey;
private String species;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;

import org.alliancegenome.curation_api.model.document.es.ESDocument;
Expand All @@ -22,7 +21,6 @@ public VariantSearchResultDocument() {

private boolean searchable;
private String name;
@JsonProperty("name_key")
private String nameKey;
private String primaryKey;
private String species;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package org.alliancegenome.es.model.search;

import lombok.Getter;
import lombok.Setter;
import lombok.Data;

@Getter @Setter
@Data
public class RelatedDataLink {

private String category;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<checkstyle.version>10.17.0</checkstyle.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<curation.version>v0.47.14</curation.version>
<curation.version>v0.47.15</curation.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
Loading