﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11220	__similar in filter	Filip Gruszczyński	nobody	"I would like to propose a new filtering method for char fields, that could be used instead of {{{ __exact }}} or {{{ __iexact. __similar }}} would return models, which field is similar to the given string. Example use case looks like this: user wants to search for some term, so we try to find objects, that satisfy his query.

{{{
objects = Klass.objects.filter(name__iexact=user_term)
if objects.count() > 0:
  return render_to_response('found.html', {'objects': 'objects'})
else:
  names = Klass.objects.filter(name__similar=user_term).values('name')
  return render_to_response('did_you_mean.html', {'names': names})
}}}

If he inputs name, that can't be found, we try to find to some suggestions, like Google does. I don't really know, if databases support this kind of operations. Could this be done? If it can be done and someone could point me, where I should start, I could try to create a patch."		closed	Uncategorized	1.0		wontfix			Unreviewed	0	0	0	0	0	0
