Reviewers: mp+226910_code.launchpad.net, Message: Please take a look. Description: Make ngram searches work. After the ngram search was deployed it was discovered to only work if 1) using the API and 2) had autocomplete=true. Inspecting the code showed the intent for ngram to be used in other situations, and there was not documented rationale for only using it when doing autocomplete. The problem was simply in the query for non-autocomplete the field for the ngrams was prefixed with 'data.' when it should not have been. The ngrams fields were moved out of the charm and bundle fields and passed as separate fields, treated like 'provides' and 'requires', to avoid the prefixing. As a result of this change, the search on the manage.jujucharms.com page now uses ngrams too. QA: First, ingest some data: # ttyn $ make run # ttyn+1 $ bin/es-update $ bin/ingest-queued --prefix=~cabs-team/ ## gets sugarcrm $ bin/ingest-queued --prefix=~charmers/charms/ ## gets a bunch of charms $ bin/ingest-queued --prefix=~bac ## gets a bundle Without autocomplete an ngram search is done in addition to the other fields. This search will find items with 'popular' in the description. http://127.0.0.1:2464/api/3/search?text=popular But turning on autocomplete limits to the ngram of the item name. Nothing found. http://127.0.0.1:2464/api/3/search?text=popular&autocomplete=true These two should find items with names and free text, followed by just names. http://127.0.0.1:2464/api/3/search?text=sql http://127.0.0.1:2464/api/3/search?text=sql&autocomplete=true This is the entry point used by the search box on the web page. http://127.0.0.1:2464/api/3/search?text=sql https://code.launchpad.net/~bac/charmworld/ngram-inquiry/+merge/226910 (do not edit description out of merge proposal) Please review this at https://codereview.appspot.com/117810044/ Affected files (+74, -9 lines): A [revision details] M charmworld/search.py M charmworld/tests/test_search.py Index: [revision details] === added file '[revision details]' --- [revision details] 2012-01-01 00:00:00 +0000 +++ [revision details] 2012-01-01 00:00:00 +0000 @@ -0,0 +1,2 @@ +Old revision: tarmac-20140521163857-dgt0onkdb3begqkj +New revision: