Closed Bug 673985 Opened 13 years ago Closed 13 years ago

Let ES index our users

Categories

(addons.mozilla.org Graveyard :: Search, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: clouserw, Assigned: jbalogh)

Details

Andy is doing a user search and ES is the way to go.  If this is already done, then awesome, this bug can be closed.  Otherwise, can you throw users into an index that we can hit?
andym: What attributes do you want to search on and sort on?
Let's do:
    id, email, username, display_name, bio, homepage, location, occupation

This should (optionally) include `deleted=1` users too
Target Milestone: 6.1.8 → 6.1.9
https://github.com/jbalogh/zamboni/commit/89cacba 

In [19]: UserProfile.search().query(email='jbalogh').values('_source').raw()
Out[19]: 
{u'_shards': {u'failed': 0, u'successful': 5, u'total': 5},
 u'hits': {u'hits': [{u'_id': u'4043307',
                      u'_index': u'preview-amo',
                      u'_score': 7.9860829999999998,
                      u'_source': {u'bio': u'http://jbalogh.me/',
                                   u'deleted': False,
                                   u'display_name': u'jbalogh',
                                   u'email': u'jbalogh@XXX.com',
                                   u'id': 4043307,
                                   u'username': u'jbalogh'},
                      u'_type': u'users',
                      u'fields': {u'id': 4043307}}],
           u'max_score': 7.9860829999999998,
           u'total': 1},
 u'timed_out': False,
 u'took': 61}

In [22]: UserProfile.search().query(display_name='clouserw').values('_source').raw()
Out[22]: 
{u'_shards': {u'failed': 0, u'successful': 5, u'total': 5},
 u'hits': {u'hits': [{u'_id': u'10482',
                      u'_index': u'preview-amo',
                      u'_score': 12.815198000000001,
                      u'_source': {u'bio': u'I work on <a href="http://outgoing.mozilla.org/v1/51e7dc9f271e3c461c45497bbf53e19150318b87/http%3A//addons.mozilla.org" rel="nofollow">addons.mozilla.org</a>.',
                                   u'deleted': False,
                                   u'display_name': u'clouserw',
                                   u'email': u'clouserw@XXX.com',
                                   u'homepage': u'http://micropipes.com/blog/',
                                   u'id': 10482,
                                   u'location': u'Portland, OR',
                                   u'occupation': u'Internets',
                                   u'username': u'clouserw'},
                      u'_type': u'users',
                      u'fields': {u'id': 10482}}],
           u'max_score': 12.815198000000001,
           u'total': 1},
 u'timed_out': False,
 u'took': 2}

In [24]: list(UserProfile.search().query(bio__text='love').values('bio'))
Out[24]: 
[(4763938, u'Love me, love my FOX.'),
 (4926273, u'love is selfish...'),
 (4719596, u'live love laugh and always love GOD'),
 (925178, u'I love Firefox!'),
 (4738954, u'I love Mozilla Firefox!!! '),
 (4894888, u'I Love Manga !!!'),
 (2661908, u'A fat geek in love with music'),
 (4808063, u'I love FireFox!!!!'),
 (4998028, u'I love forex trading'),
 (3119933, u'I LOVE FIREFOX.')]
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.