Skip to content

Commit feff7f6

Browse files
filipweidemannmarksweb
authored andcommitted
fix: simplify index example even further and fix small bug
1 parent 77e851e commit feff7f6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

docs/explanation/searchdocs.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@ A very simple index could look something like this:
5252
).distinct()
5353
5454
def prepare(self, instance: PageContent) -> dict:
55-
request = self.get_request_instance(current_language)
5655
self.prepared_data = super().prepare(instance)
5756
self.prepared_data["url"] = instance.page.get_absolute_url()
5857
self.prepared_data["title"] = instance.title
5958
self.prepared_data["text"] = (
60-
self.prepared_data["title"] + instance.page.meta_description or ""
59+
self.prepared_data["title"] + (instance.meta_description or "")
6160
)
6261
return self.prepared_data
6362
@@ -129,4 +128,4 @@ You can inspect your index using a ``SearchQuerySet``:
129128
print(result.text)
130129
131130
Now it's up to you to add custom indexes to your own models, build views for your
132-
``SearchQuerySet`` to implement a search form and much more.
131+
``SearchQuerySet`` to implement a search form and much more.

0 commit comments

Comments
 (0)