[ 
https://issues.apache.org/jira/browse/SOLR-5624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13911228#comment-13911228
 ] 

David commented on SOLR-5624:
-----------------------------

I think the solution would be to remove the documents from liveDocs that share 
the same groupid in the getBoostDocs() function. Let me know if this makes any 
sense. I'll continue working towards a solution in the meantime.

{code}
private IntOpenHashSet getBoostDocs(SolrIndexSearcher indexSearcher, 
Set<String> boosted) throws IOException {
      IntOpenHashSet boostDocs = null;
      if(boosted != null) {
        SchemaField idField = indexSearcher.getSchema().getUniqueKeyField();
        String fieldName = idField.getName();
        HashSet<BytesRef> localBoosts = new HashSet(boosted.size()*2);
        Iterator<String> boostedIt = boosted.iterator();
        while(boostedIt.hasNext()) {
          localBoosts.add(new BytesRef(boostedIt.next()));
        }

        boostDocs = new IntOpenHashSet(boosted.size()*2);

        List<AtomicReaderContext>leaves = 
indexSearcher.getTopReaderContext().leaves();
        TermsEnum termsEnum = null;
        DocsEnum docsEnum = null;
        for(AtomicReaderContext leaf : leaves) {
          AtomicReader reader = leaf.reader();
          int docBase = leaf.docBase;
          Bits liveDocs = reader.getLiveDocs();
          Terms terms = reader.terms(fieldName);
          termsEnum = terms.iterator(termsEnum);
          Iterator<BytesRef> it = localBoosts.iterator();
          while(it.hasNext()) {
            BytesRef ref = it.next();
            if(termsEnum.seekExact(ref)) {
              docsEnum = termsEnum.docs(liveDocs, docsEnum);
              int doc = docsEnum.nextDoc();
              if(doc != -1) {
                //Found the document.
                boostDocs.add(doc+docBase);

               *// HERE REMOVE ANY DOCUMENTS THAT SHARE THE GROUPID NOT ONLY 
THE DOCID //*
                it.remove();



              }
            }
          }
        }
      }

      return boostDocs;
    }
{code}

> Enable QueryResultCache for CollapsingQParserPlugin
> ---------------------------------------------------
>
>                 Key: SOLR-5624
>                 URL: https://issues.apache.org/jira/browse/SOLR-5624
>             Project: Solr
>          Issue Type: Task
>    Affects Versions: 4.6
>            Reporter: David
>            Assignee: Joel Bernstein
>             Fix For: 4.7, 5.0
>
>         Attachments: SOLR-5624.patch, SOLR-5624.patch, SOLR-5624.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to