Merge lp:~bac/charmworld/ngram-inquiry into lp:charmworld
Status: | Merged |
---|---|
Approved by: | Brad Crittenden |
Approved revision: | 516 |
Merged at revision: | 516 |
Proposed branch: | lp:~bac/charmworld/ngram-inquiry |
Merge into: | lp:charmworld |
Diff against target: |
144 lines (+72/-9) 2 files modified
charmworld/search.py (+6/-7) charmworld/tests/test_search.py (+66/-2) |
To merge this branch: | bzr merge lp:~bac/charmworld/ngram-inquiry |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Gui Bot | continuous-integration | Approve | |
Madison Scott-Clary (community) | Approve | ||
Review via email: mp+226910@code.launchpad.net |
Commit message
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.
uses ngrams too.
https:/
R=makyo
Description of the change
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.
uses ngrams too.
QA:
First, ingest some data:
# ttyn
$ make run
# ttyn+1
$ bin/es-update
$ bin/ingest-queued --prefix=
$ bin/ingest-queued --prefix=
$ 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://
But turning on autocomplete limits to the ngram of the item name. Nothing
found.
http://
These two should find items with names and free text, followed by just names.
http://
http://
This is the entry point used by the search box on the web page.
http://
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 ~cabs-team/ ## gets sugarcrm ~charmers/ charms/ ## gets a bunch of charms
$ bin/es-update
$ bin/ingest-queued --prefix=
$ bin/ingest-queued --prefix=
$ bin/ingest-queued --prefix=~bac ## gets a bundle
Without autocomplete an ngram search is done in addition to the other 127.0.0. 1:2464/ api/3/search? text=popular
fields. This search will find items with 'popular' in the description.
http://
But turning on autocomplete limits to the ngram of the item name. 127.0.0. 1:2464/ api/3/search? text=popular& autocomplete= true
Nothing
found.
http://
These two should find items with names and free text, followed by just 127.0.0. 1:2464/ api/3/search? text=sql 127.0.0. 1:2464/ api/3/search? text=sql& autocomplete= true
names.
http://
http://
This is the entry point used by the search box on the web page. 127.0.0. 1:2464/ api/3/search? text=sql
http://
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): search. py tests/test_ search. py
A [revision details]
M charmworld/
M charmworld/
Index: [revision details] 20140521163857- dgt0onkdb3begqk j
=== 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-
+New revision: <email address hidden>
Index: charmworld/ search. py search. py' search. py 2014-05-19 23:44:29 +0000 search. py 2014-07-15 19:09:59 +0000 free_text_ fields = { description' : 3, config. options. description' : None, free_text_ fields = { basket_ name': 5, description' : 3,
"fields" : {
"ngrams" : {
"type" : "string",
},
"name" : {
"type" : "string",
=== modified file 'charmworld/
--- charmworld/
+++ charmworld/
@@ -32,7 +32,6 @@
]
charm_
'name': 10,
- 'ngrams': None,
'summary': 5,
'
'
@@ -46,7 +45,6 @@
]
bundle_
'name': 10,
- 'ngrams': None,
'
'
'title': None,
@@ -353,7 +351,7 @@
- "analyzer": "n3_20grams"
+ "analyzer": "n3_20grams",
@@ -490,12 +488,13 @@