You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Adrien Grand <jp...@gmail.com> on 2016/04/11 19:18:44 UTC

Re: [1/2] lucene-solr:master: LUCENE-7196 - guaranteed class coverage in split indexes through grouping by class

Hi Tommaso,

Le lun. 11 avr. 2016 à 10:12, <to...@apache.org> a écrit :

> +    <pathelement path="${grouping.jar}"/>
>
> +
> +    HashMap<String, UninvertingReader.Type> mapping = new HashMap<>();
> +    mapping.put(classFieldName, UninvertingReader.Type.SORTED);
> +    UninvertingReader uninvertingReader = new
> UninvertingReader(originalIndex, mapping);
> +      IndexSearcher indexSearcher = new IndexSearcher(uninvertingReader);
> +      GroupingSearch gs = new GroupingSearch(classFieldName);
> +      gs.setGroupSort(Sort.INDEXORDER);
> +      gs.setSortWithinGroup(Sort.INDEXORDER);
> +      gs.setAllGroups(true);
> +      gs.setGroupDocsLimit(originalIndex.maxDoc());
> +      TopGroups<Object> topGroups = gs.search(indexSearcher, new
> MatchAllDocsQuery(), 0, (int) noOfClasses);
>

I have been looking at this commit because of the javadocs failures and it
feels wrong to me that we are adding dependencies to the misc and grouping
modules just for this utility class that splits indices? I think we could
make it work in a similar way to PKIndexSplitter which would not require
grouping or UninvertingReader.