diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py index fc55a2a4599..1c5d0a848b4 100644 --- a/sphinx/search/__init__.py +++ b/sphinx/search/__init__.py @@ -331,13 +331,13 @@ def get_objects(self, fn2index): for domainname, domain in sorted(iteritems(self.env.domains)): for fullname, dispname, type, docname, anchor, prio in \ sorted(domain.get_objects()): - # XXX use dispname? if docname not in fn2index: continue if prio < 0: continue fullname = htmlescape(fullname) - prefix, name = rpartition(fullname, '.') + dispname = htmlescape(dispname) + prefix, name = rpartition(dispname, '.') pdict = rv.setdefault(prefix, {}) try: typeindex = otypes[domainname, type] diff --git a/tests/test_search.py b/tests/test_search.py index aa315c40568..886151831dc 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -161,7 +161,7 @@ def test_IndexBuilder(): 'docnames': ('docname', 'docname2'), 'envversion': '1.0', 'filenames': ['filename', 'filename2'], - 'objects': {'': {'objname': (0, 0, 1, '#anchor')}}, + 'objects': {'': {'objdispname': (0, 0, 1, '#anchor')}}, 'objnames': {0: ('dummy', 'objtype', 'objtype')}, 'objtypes': {0: 'dummy:objtype'}, 'terms': {'comment': [0, 1],