Skip to content

Commit ebf6e37

Browse files
committed
Extract slugs when querying Solr.
1 parent 981b702 commit ebf6e37

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

docker/solr/conf/managed-schema

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@
116116

117117
<field name="title" type="text_general" multiValued="false" indexed="true" stored="true" />
118118
<field name="abstract" type="text_general" multiValued="false" indexed="true" stored="true" />
119+
<field name="slug" type="text_general" multiValued="false" indexed="false" stored="true" required="true" />
119120
<field name="year" type="pint" multiValued="false" indexed="true" stored="true" required="false" />
120-
<field name="month" type="pint" multiValued="false" indexed="true" stored="true" required="false" />
121-
<field name="day" type="pint" multiValued="false" indexed="true" stored="true" required="false" />
121+
<field name="month" type="pint" multiValued="false" indexed="true" stored="false" required="false" />
122+
<field name="day" type="pint" multiValued="false" indexed="true" stored="false" required="false" />
122123

123124
<!-- Combine the "title" and "abstract" fields so that we search both when performing basic search -->
124125
<copyField source="title" dest="basic_search" />

docker/solr/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cat > "${DATA_CONFIG}" <<- EOXML
2020
password="$POSTGRES_PASSWORD" />
2121
2222
<document name="entries">
23-
<entity name="compendium" query="select id, title, abstract, url, year, month, day from compendium" />
23+
<entity name="compendium" query="select id, title, abstract, slug, url, year, month, day from compendium" />
2424
</document>
2525
2626
</dataConfig>

src/search/solr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def basic_search(self, query: Dict[str, List[str]]):
4141
kwargs = {
4242
"rows": rows,
4343
"start": start,
44-
"fl": "id,title,abstract,year,month,day",
44+
"fl": "id,title,abstract,slug,year,month,day",
4545
}
4646

4747
results = self.solr.search(query_str, **kwargs)

0 commit comments

Comments
 (0)