[ 
https://issues.apache.org/jira/browse/LUCENE-1483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657805#action_12657805
 ] 

Mark Miller commented on LUCENE-1483:
-------------------------------------

A slightly improved setNextReader for the ords case:

{code}
   public void setNextReader(IndexReader reader) throws IOException {
      
      // Map ords in queue to ords in reader
      
      StringIndex currentReaderValues = ExtendedFieldCache.EXT_DEFAULT
          .getStringIndex(reader, field);
      
      lookup = currentReaderValues.lookup;
      order = currentReaderValues.order;

      if (lookup.length == 0) {
        return;
      }
      
//      for (int i = 0; i < lookup.length; i++) {
//        System.out.println("i:" + i + " " + lookup[i]);
//      }

      Map map = new HashMap();
      for (int i = 0; i < slot + 1; i++) {
        String val = values[i];
        if (val == null) {
          continue;
        }

        int index = binarySearch(lookup, val);

        if (index < 0) {
          int ord = -index - 2;
          Integer intOrd = Integer.valueOf(ord);
          List slotVals = (List) map.get(intOrd);
          if (slotVals == null) {
            slotVals = new ArrayList();
            slotVals.add(new SlotValPair(i, val));
            map.put(intOrd, slotVals);
          } else {
            slotVals.add(new SlotValPair(i, val));
          }

          ords[i] = ord;
        } else {
          ords[i] = index;
          subords[i] = 0;
        }
      }

      Iterator dit = map.values().iterator();
      while (dit.hasNext()) {
        List list = (List) dit.next();
        if (list.size() > 1) {
          Collections.sort(list);

          for (int i = 0; i < list.size(); i++) {
            SlotValPair svp = (SlotValPair) list.get(i);
            subords[svp.i] = i+1;
          }
        } else {
          SlotValPair svp = (SlotValPair) list.get(0);
          subords[svp.i] = 1;
        }
      }

    }
{code}

> Change IndexSearcher to use MultiSearcher semantics for multiple subreaders
> ---------------------------------------------------------------------------
>
>                 Key: LUCENE-1483
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1483
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.9
>            Reporter: Mark Miller
>            Priority: Minor
>         Attachments: LUCENE-1483.patch, LUCENE-1483.patch, LUCENE-1483.patch, 
> LUCENE-1483.patch, LUCENE-1483.patch, LUCENE-1483.patch, LUCENE-1483.patch, 
> LUCENE-1483.patch, LUCENE-1483.patch, LUCENE-1483.patch, LUCENE-1483.patch, 
> LUCENE-1483.patch, LUCENE-1483.patch, LUCENE-1483.patch, LUCENE-1483.patch
>
>
> FieldCache and Filters are forced down to a single segment reader, allowing 
> for individual segment reloading on reopen.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to