cfpb / sheer

A tool for loading arbitrary content into Elasticsearch and serving that content on the web.
Creative Commons Zero v1.0 Universal
29 stars 23 forks source link

possible_values_for not returning correct information #18

Closed himedlooff closed 10 years ago

himedlooff commented 10 years ago

When using queries.posts.possible_values_for('tags') (as seen here https://github.com/cfpb/cfgov-refresh/blob/gh-pages/blog/index.html#L146) I'm not getting the same results as when I use for tag in post.tags (as seen here https://github.com/cfpb/cfgov-refresh/blob/gh-pages/blog/_single.html#L85).

himedlooff commented 10 years ago

When I do:

{% for tags in queries.posts.possible_values_for('tags') %}
{{ tags }}
{% endfor %}

I get:

{u'count': 67, u'term': u'Mortgages'}
{u'count': 62, u'term': u'Students'}
{u'count': 47, u'term': u'Student loans'}
{u'count': 38, u'term': u'Financial education'}
{u'count': 35, u'term': u'Rulemaking'}
{u'count': 31, u'term': u'Servicemembers'}
{u'count': 22, u'term': u'Livestream'}
{u'count': 21, u'term': u'Video'}
{u'count': 21, u'term': u'Older Americans'}
{u'count': 19, u'term': u'Know Before You Owe'}
rosskarchner commented 10 years ago

''' queries.posts.possible_values_for('tags') ''' Is all the known tags across all posts.

""" for tag in post.tags """

Is all the tags on the given posts. Is it not behaving that way?

rosskarchner commented 10 years ago

Actually-- I think I understand the issue. It's only returning the first 10

himedlooff commented 10 years ago

Right, that's the issue. Sorry it wasn't clear.

rosskarchner commented 10 years ago

I just pushed a change to sheer that should correctly return the entire universe of values for a field-- give it a try!

rosskarchner commented 10 years ago

I've reverted that change, and am working on a new solution

rosskarchner commented 10 years ago

OK, I'm not proud of this solution, but it should work until we have a field with more than 10,000 possible values ;)