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

SOLR-8776: Support RankQuery in grouping #162

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

Conversation

diegoceccarelli
Copy link
Contributor

Update SOLR-8776 to current master

  • Reranking and grouping work together in non-distributed setting when grouping is done by field
  • Still have to fix for distribute setting and for grouping based on the unique values of a function query.

@@ -39,6 +39,14 @@
private final Sort withinGroupSort;
private final int maxDocsPerGroup;

protected TopGroupsCollector(GroupReducer<T, TopDocsCollector<?>> groupReducer, GroupSelector<T> groupSelector, Collection<SearchGroup<T>> groups, Sort groupSort, Sort withinGroupSort,
int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) {
super(groupSelector, groups, groupReducer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove a few of these parameters now, I think? They're for the Reducer, and as such don't need to be passed separately.

topsGroupsActionBuilder.addCommandField(new SearchGroupsFieldCommand.Builder()
.setField(schema.getField(field))
.setGroupSort(groupingSpec.getGroupSort())
.setTopNGroups(cmd.getOffset() + cmd.getLen())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it reRanking with respect to the "start" param in the solr query?
Looks like the original LTR plugin is supposed to reRank top K irrespective of the offset.
ref.http://lucene.472066.n3.nabble.com/Learning-to-Rank-LTR-with-grouping-td4366691i20.html#a4387929

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, this currently reranks the top start + rerankDocuments , I'll fix it. Thank you

@@ -1270,7 +1270,7 @@ private void doProcessGroupedDistributedSearchFirstPhase(ResponseBuilder rb, Que
final int topNGroups;
Query query = cmd.getQuery();
if (query instanceof AbstractReRankQuery){
topNGroups = cmd.getOffset() + ((AbstractReRankQuery)query).getReRankDocs();
topNGroups = Math.max(((AbstractReRankQuery)query).getReRankDocs(), cmd.getOffset() + cmd.getLen());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be handled for non distributed case as well in doProcessGroupedSearch(..), when pageSize>reRankDocs it returns only "reRankDocs" groups in non distributed case.

Copy link
Contributor Author

@diegoceccarelli diegoceccarelli Apr 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the non distributed case looks fine to me, I'll double check tomorrow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were right, I added a unit test and it is failing :/ I'm working on it

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lucene parts look fine to me @diegoceccarelli

@@ -52,6 +52,7 @@
public SecondPassGroupingCollector(GroupSelector<T> groupSelector, Collection<SearchGroup<T>> groups, GroupReducer<T, ?> reducer) {

//System.out.println("SP init");
//Do we want to check if groups is null here? instead of checking at line 62?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@diegoceccarelli diegoceccarelli force-pushed the master-solr-8776 branch 2 times, most recently from 013f4da to c7281e6 Compare April 23, 2019 18:06
@diegoceccarelli
Copy link
Contributor Author

updated to the current master

markrmiller added a commit that referenced this pull request Jul 15, 2020
epugh pushed a commit to epugh/lucene-solr-1 that referenced this pull request Sep 3, 2021
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.

3 participants