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

Support result grouping #24

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Support result grouping #24

wants to merge 6 commits into from

Conversation

divideby0
Copy link

Solr 3.3 added support for result grouping such that results can be returned hierarchically grouped by a common field value like so:

major_value: a
   major_value: a, minor_value: 1
   major_value: a, minor_value: 2
   major_value: a, minor_value: 3
major_value: b
   major_value: b, minor_value: 4
   major_value: b, minor_value: 5

This functionality is particularly useful in retail searching where there are a number of "SKU"s (Red Mens Small, Blue Womens Medium) under a particular "product" (Awesome T-shirt #4).

I added support for this functionality to sunburnt such that you can call:

resp = s.query().group_by('major_value', limit=10).execute()

and get back a list of groupings as resp.result.groups:

for major_value. docs in resp.result.groups:
  print("major_value: %s, # of docs: %s" % (major_value, len(docs))
  for doc in docs:
    print("  major_value: %s, minor_value: %s" % (doc['major_value'], doc['minor_value'])

which yields:

major_value: a, # of docs: 3
   major_value: a, minor_value: 1
   major_value: a, minor_value: 2
   major_value: a, minor_value: 3
major_value: b, # of docs: 2
   major_value: b, minor_value: 4
   major_value: b, minor_value: 5

A screencast detailing the enhancements and usage will be made available shortly.

@vreon
Copy link

vreon commented Nov 29, 2011

Bump :D

Would be way cool to see this merged into master. Any thoughts, @tow?

@divideby0
Copy link
Author

Just a side-note, there's a new feature in Solr 3.4 that I'd also eventually like to roll in, post-grouping facet counts. I plan to get to this by the end of the year, but in the meantime a merge or feedback on a merge on what's here would be super-helpful.

@tow
Copy link
Owner

tow commented Nov 29, 2011

Sorry - have been busy recently!

I haven't had a chance to look at this properly; however what would make it much easier for me to check & merge is a) docs and b) tests.

I'm aiming to do a big merge & release in the next week or two, but nothing will get pulled in until it's fully documented & tested - there's more chance of something getting in quickly if it comes with docs & tests already attached!

@denizdogan
Copy link

Has anything more happened here?

@mlissner
Copy link
Contributor

This is many years old, but did anybody ever pursue this PR? @divideby0 do you have a fork somewhere with this?

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

5 participants