Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode searches #57

Merged
merged 17 commits into from
Feb 21, 2017
Merged

Unicode searches #57

merged 17 commits into from
Feb 21, 2017

Conversation

grapesmoker
Copy link
Contributor

This PR wraps the search term in Django's smart_text Unicode converter so that you can do searches using Unicode characters in the search bar.

@grapesmoker
Copy link
Contributor Author

Some background on what this PR does: the problem with the search turned out to be mostly about the Elasticsearch backend. In order to get Elastic to do things like turn Unicode characters (e.g. é) into their nearest ASCII equivalent, you need to enable an analyzer filter called asciifolding. Since the Elastic config is handled via haystack, the way to fix this is to add a settings dict that will be passed to Elastic when the index is built. This PR therefore has been updated to contain just such a dict; the settings also change the default tokenizer from standard to whitespace. The reasoning here is to allow users to search for things like "$500" (note the dollar sign); otherwise, many of those special characters are dropped during indexing.

This PR also adds a SuggestedSearchResult model which returns what we think are the most relevant results for a few specific search terms (e.g. "401k").

root and others added 7 commits January 24, 2017 12:58
Removes existing temporary solution for that; adds a `name` field to the returned data from the SuggestedSearchResult's `to_dict` function; adds output for a suggested result to the search results template.
@Scotchester
Copy link
Contributor

I'm not sure why Travis's tests are failing. They run fine for me locally, except for one Mystery Meet test (which fails because the fixtures were overridden by my loaded DB dump). That Mystery Meet test does not seem to be failing on Travis, though.

@Scotchester
Copy link
Contributor

Per discussion in chat, we're going to go ahead with merging this and deploying it to our test server to see if there are any failures there.

@Scotchester Scotchester merged commit 926414f into cfpb:master Feb 21, 2017
Scotchester added a commit that referenced this pull request Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants