Java Code Examples for com.carrotsearch.hppc.IntIntHashMap#iterator()

The following examples show how to use com.carrotsearch.hppc.IntIntHashMap#iterator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CollapsingQParserPlugin.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public OrdFieldValueStrategy(int maxDoc,
                             int valueCount,
                             int nullPolicy,
                             boolean needsScores,
                             IntIntHashMap boostDocsMap,
                             SortedDocValues values) {
  this.ords = new IntIntDynamicMap(valueCount, -1);
  this.nullPolicy = nullPolicy;
  this.needsScores = needsScores;
  this.collapsedSet = new FixedBitSet(maxDoc);
  if(boostDocsMap != null) {
    this.boosts = true;
    this.boostOrds = new IntArrayList();
    this.boostDocs = new IntArrayList();
    int[] bd = new int[boostDocsMap.size()];
    Iterator<IntIntCursor> it =  boostDocsMap.iterator();
    int index = -1;
    while(it.hasNext()) {
      IntIntCursor cursor = it.next();
      bd[++index] = cursor.key;
    }

    Arrays.sort(bd);
    this.mergeBoost = new MergeBoost(bd);
    this.boosted = true;
  }

  if (this.needsScores) {
    this.scores = new IntFloatDynamicMap(valueCount, 0.0f);
    if(nullPolicy == CollapsingPostFilter.NULL_POLICY_EXPAND) {
      nullScores = new FloatArrayList();
    }
  }
}
 
Example 2
Source File: CollapsingQParserPlugin.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public IntFieldValueStrategy(int maxDoc,
                             int size,
                             String collapseField,
                             int nullValue,
                             int nullPolicy,
                             boolean needsScores,
                             IntIntHashMap boostDocsMap) {
  this.collapseField = collapseField;
  this.nullValue = nullValue;
  this.nullPolicy = nullPolicy;
  this.needsScores = needsScores;
  this.collapsedSet = new FixedBitSet(maxDoc);
  this.cmap = new IntIntHashMap(size);
  this.docs = new IntIntDynamicMap(size, 0);
  if(boostDocsMap != null) {
    this.boosts = true;
    this.boostDocs = new IntArrayList();
    this.boostKeys = new IntArrayList();
    int[] bd = new int[boostDocsMap.size()];
    Iterator<IntIntCursor> it =  boostDocsMap.iterator();
    int index = -1;
    while(it.hasNext()) {
      IntIntCursor cursor = it.next();
      bd[++index] = cursor.key;
    }

    Arrays.sort(bd);
    this.mergeBoost = new MergeBoost(bd);
  }

  if(needsScores) {
    this.scores = new IntFloatDynamicMap(size, 0.0f);
    if(nullPolicy == CollapsingPostFilter.NULL_POLICY_EXPAND) {
      nullScores = new FloatArrayList();
    }
  }
}
 
Example 3
Source File: CollapsingQParserPlugin.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public OrdScoreCollector(int maxDoc,
                         int segments,
                         DocValuesProducer collapseValuesProducer,
                         int nullPolicy,
                         IntIntHashMap boostDocsMap,
                         IndexSearcher searcher) throws IOException {
  this.maxDoc = maxDoc;
  this.contexts = new LeafReaderContext[segments];
  List<LeafReaderContext> con = searcher.getTopReaderContext().leaves();
  for(int i=0; i<con.size(); i++) {
    contexts[i] = con.get(i);
  }

  this.collapsedSet = new FixedBitSet(maxDoc);
  this.collapseValuesProducer = collapseValuesProducer;
  this.collapseValues = collapseValuesProducer.getSorted(null);

  int valueCount = collapseValues.getValueCount();
  if(collapseValues instanceof MultiDocValues.MultiSortedDocValues) {
    this.multiSortedDocValues = (MultiDocValues.MultiSortedDocValues)collapseValues;
    this.ordinalMap = multiSortedDocValues.mapping;
  }
  this.ords = new IntIntDynamicMap(valueCount, -1);
  this.scores = new IntFloatDynamicMap(valueCount, -Float.MAX_VALUE);
  this.nullPolicy = nullPolicy;
  if(nullPolicy == CollapsingPostFilter.NULL_POLICY_EXPAND) {
    nullScores = new FloatArrayList();
  }

  if(boostDocsMap != null) {
    this.boosts = true;
    this.boostOrds = new IntArrayList();
    this.boostDocs = new IntArrayList();
    int[] bd = new int[boostDocsMap.size()];
    Iterator<IntIntCursor> it =  boostDocsMap.iterator();
    int index = -1;
    while(it.hasNext()) {
      IntIntCursor cursor = it.next();
      bd[++index] = cursor.key;
    }

    Arrays.sort(bd);
    this.mergeBoost = new MergeBoost(bd);
  }
}
 
Example 4
Source File: CollapsingQParserPlugin.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public IntScoreCollector(int maxDoc,
                         int segments,
                         int nullValue,
                         int nullPolicy,
                         int size,
                         String field,
                         IntIntHashMap boostDocsMap,
                         IndexSearcher searcher) {
  this.maxDoc = maxDoc;
  this.contexts = new LeafReaderContext[segments];
  List<LeafReaderContext> con = searcher.getTopReaderContext().leaves();
  for(int i=0; i<con.size(); i++) {
    contexts[i] = con.get(i);
  }

  this.collapsedSet = new FixedBitSet(maxDoc);
  this.nullValue = nullValue;
  this.nullPolicy = nullPolicy;
  if(nullPolicy == CollapsingPostFilter.NULL_POLICY_EXPAND) {
    nullScores = new FloatArrayList();
  }
  this.cmap = new IntLongHashMap(size);
  this.field = field;

  if(boostDocsMap != null) {
    this.boosts = true;
    this.boostDocs = new IntArrayList();
    this.boostKeys = new IntArrayList();
    int[] bd = new int[boostDocsMap.size()];
    Iterator<IntIntCursor> it =  boostDocsMap.iterator();
    int index = -1;
    while(it.hasNext()) {
      IntIntCursor cursor = it.next();
      bd[++index] = cursor.key;
    }

    Arrays.sort(bd);
    this.mergeBoost = new MergeBoost(bd);
    this.boosts = true;
  }

}