Skip to content

Commit

Permalink
Merge pull request #564 from monarch-initiative/solr-lowercase-keywor…
Browse files Browse the repository at this point in the history
…d-field

Adds lowercase keyword grounding field to Solr entity collection
  • Loading branch information
kevinschaper authored Feb 1, 2024
2 parents 94d219d + 4849b04 commit fc341ce
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
32 changes: 32 additions & 0 deletions scripts/add_entity_copyfields.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ curl -X POST -H 'Content-type:application/json' --data-binary '{
}
}' http://localhost:8983/solr/entity/schema

# Add a dynamic field for the grounding field type

curl -X POST -H 'Content-type:application/json' --data-binary '{
"add-dynamic-field": {
"name": "*_grounding",
"type": "grounding",
"indexed": true,
"stored": false,
"multiValued": true,
}
}' http://localhost:8983/solr/entity/schema

# now add copyfields declarations for name, symbol and synonym

Expand All @@ -52,6 +63,13 @@ curl -X POST -H 'Content-type:application/json' --data-binary '{
}
}' http://localhost:8983/solr/entity/schema

curl -X POST -H 'Content-type:application/json' --data-binary '{
"add-copy-field": {
"source": "name",
"dest": "name_grounding"
}
}' http://localhost:8983/solr/entity/schema

# symbol

curl -X POST -H 'Content-type:application/json' --data-binary '{
Expand All @@ -68,6 +86,13 @@ curl -X POST -H 'Content-type:application/json' --data-binary '{
}
}' http://localhost:8983/solr/entity/schema

curl -X POST -H 'Content-type:application/json' --data-binary '{
"add-copy-field": {
"source": "symbol",
"dest": "symbol_grounding"
}
}' http://localhost:8983/solr/entity/schema

# synonym

curl -X POST -H 'Content-type:application/json' --data-binary '{
Expand All @@ -84,6 +109,13 @@ curl -X POST -H 'Content-type:application/json' --data-binary '{
}
}' http://localhost:8983/solr/entity/schema

curl -X POST -H 'Content-type:application/json' --data-binary '{
"add-copy-field": {
"source": "synonym",
"dest": "synonym_grounding"
}
}' http://localhost:8983/solr/entity/schema

# taxon label

curl -X POST -H 'Content-type:application/json' --data-binary '{
Expand Down
1 change: 1 addition & 0 deletions scripts/add_fieldtypes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ for core in entity association
do
curl -X POST -H 'Content-type:application/json' -d @scripts/text-fieldtype.json http://localhost:8983/solr/$core/schema
curl -X POST -H 'Content-type:application/json' -d @scripts/autocomplete-fieldtype.json http://localhost:8983/solr/$core/schema
curl -X POST -H 'Content-type:application/json' -d @scripts/grounding-fieldtype.json http://localhost:8983/solr/$core/schema
done
15 changes: 15 additions & 0 deletions scripts/grounding-fieldtype.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"add-field-type": {
"name": "grounding",
"class": "solr.TextField",
"positionIncrementGap": "100",
"analyzer": {
"tokenizer": {
"class": "solr.KeywordTokenizerFactory"
},
"filters": [
{ "class": "solr.LowerCaseFilterFactory" }
]
}
}
}

0 comments on commit fc341ce

Please sign in to comment.