@@ -59,8 +59,11 @@ class PageDocument(RTDDocTypeMixin, Document):
59
59
Simple analyzer will break the text in non-letter characters,
60
60
so a text like ``python.submodule`` will be broken like [python, submodule]
61
61
instead of [python.submodule].
62
+ See more at https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-analyzers.html # noqa
62
63
63
- https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-analyzers.html
64
+ Some text fields use the ``with_positions_offsets`` term vector,
65
+ this is to have faster highlighting on big documents.
66
+ See more at https://www.elastic.co/guide/en/elasticsearch/reference/7.9/term-vector.html
64
67
"""
65
68
66
69
# Metadata
@@ -77,7 +80,7 @@ class PageDocument(RTDDocTypeMixin, Document):
77
80
properties = {
78
81
'id' : fields .KeywordField (),
79
82
'title' : fields .TextField (),
80
- 'content' : fields .TextField (),
83
+ 'content' : fields .TextField (term_vector = 'with_positions_offsets' ),
81
84
}
82
85
)
83
86
domains = fields .NestedField (
@@ -89,7 +92,7 @@ class PageDocument(RTDDocTypeMixin, Document):
89
92
90
93
# For showing in the search result
91
94
'type_display' : fields .TextField (),
92
- 'docstrings' : fields .TextField (),
95
+ 'docstrings' : fields .TextField (term_vector = 'with_positions_offsets' ),
93
96
94
97
# Simple analyzer breaks on `.`,
95
98
# otherwise search results are too strict for this use case
0 commit comments