mangle Title like it's done for SearchableText (#4446)
This commit is contained in:
parent
16a42c15b7
commit
c81459df50
|
@ -88,6 +88,26 @@ def mangleSearchableText(value, config):
|
|||
return value
|
||||
|
||||
|
||||
def mangleTitle(value, config):
|
||||
levenstein_distance = getattr(config, 'levenshtein_distance', 0)
|
||||
value_parts = []
|
||||
base_value_parts = []
|
||||
|
||||
if not isSimpleSearch(value):
|
||||
return value
|
||||
|
||||
for term in splitSimpleSearch(value):
|
||||
(term_value,
|
||||
term_base_value) = makeSimpleExpressions(term,
|
||||
levenstein_distance)
|
||||
value_parts.append(term_value)
|
||||
base_value_parts.append(term_base_value)
|
||||
|
||||
base_value = ' '.join(base_value_parts)
|
||||
value = ' '.join(value_parts)
|
||||
return value
|
||||
|
||||
|
||||
def mangleQuery(keywords, config, schema):
|
||||
""" translate / mangle query parameters to replace zope specifics
|
||||
with equivalent constructs for solr """
|
||||
|
@ -129,6 +149,9 @@ def mangleQuery(keywords, config, schema):
|
|||
if key == 'SearchableText':
|
||||
keywords[key] = mangleSearchableText(value, config)
|
||||
continue
|
||||
if key == 'Title':
|
||||
keywords[key] = mangleTitle(value, config)
|
||||
continue
|
||||
if key in epi_indexes:
|
||||
path = keywords['%s_parents' % key] = value
|
||||
del keywords[key]
|
||||
|
|
Loading…
Reference in New Issue