/*
This indexes one item and gathers its content
324586
function(index, model) {
    var itemToIndex = {};
    // index all available fields for the item
    for (var i in this.config.indexes[index].indexFields) {
      var name = this.config.indexes[index].indexFields[i].name;
      if (typeof model.attributes[name] !== 'undefined' &&
          model.attributes[name] !== null) {
        var value = model.attributes[name];
        // first convert arrays to strings (we assume they are arrays of strings)
        if (Array.isArray(value)) {
          value = value.join(' ');
        }
        itemToIndex[name] = value;
      } else {
        itemToIndex[name] = '';
      }
    }
    // set the unique identifier
    itemToIndex.cid = model.cid;
    // index the item
    this.config.indexes[index].idx.add(itemToIndex);

    var itemForContent = {};
    // save all available content for the item
    for (var i in this.config.indexes[index].contentFields) {
      var name = this.config.indexes[index].contentFields[i].name;
      if (typeof model.attributes[name] !== 'undefined' &&
          model.attributes[name] !== null) {
        itemForContent[name] = model.attributes[name];
      }
    }
    // save it, keyed to its cid, for easy retrieval
    this.config.indexes[index].content[model.cid] = itemForContent;
  }
695435
public function indexedContentAction()
    {
        if ($this->id) {
            // page is selected: get indexed content
            $content = '<h2>Index content for page ' . $this->id . '</h2>';
            $content .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path')
                . ': '
                .
                GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], -50);
            $content .= $this->getIndexedContent($this->id);
        } else {
            // no page selected: show message
            $content = '<div class="alert alert-info">'
                . LocalizationUtility::translate(
                    'LLL:EXT:ke_search/Resources/Private/Language/locallang_mod.xml:select_a_page',
                    'KeSearch'
                )
                . '</div>';
        }

        $this->view->assign('content', $content);
    }
1232065
function( contentItem, index ) {
		var tab = new lm.controls.Tab( this, contentItem );
		
		if( this.tabs.length === 0 ) {
			this.tabs.push( tab );
			this.tabsContainer.append( tab.element );
			return;
		}
	
		if( index === undefined ) {
			index = this.tabs.length;
		}
	
		if( index > 0 ) {
			this.tabs[ index - 1 ].element.after( tab.element );
		} else {
			this.tabs[ 0 ].element.before( tab.element );
		}
	
		this.tabs.splice( index, 0, tab );
	}
1169030
function () {
                var oldItems = this.items;
                var oldItemsLength = oldItems.length;
                var newItems = [];
                var initialArray = this.initialArray;

                if (ariaUtilsType.isObject(initialArray)) {
                    var oldItemsMap = new ariaUtilsStackHashMap();
                    var oldElt;
                    for (var i = 0; i < oldItemsLength; i++) {
                        oldElt = oldItems[i];
                        oldItemsMap.push(oldElt.value, oldElt);
                    }

                    var j = 0;
                    for (var p in initialArray) {
                        if (initialArray.hasOwnProperty(p) && !json.isMetadata(p)) {
                            newItems[j] = oldItemsMap.pop(initialArray[p]);
                            j++;
                        }
                    }
                    oldItemsMap.$dispose();
                } else {

                    for (var i = 0; i < oldItemsLength; i++) {
                        var elt = oldItems[i];
                        newItems[elt.initIndex] = elt;
                        delete oldItems[i];
                    }
                }
                this.items = newItems;
                var curState = this._currentState;
                curState.sortOrder = this.SORT_INITIAL;
                curState.sortName = null;
                curState.sortKeyGetter = null;
                this._changes = this._changes | this._CHANGED_PAGE_DATA;
            }
1092622
function indicesToItems(target, items, indices, r) {
  for (var i = 0; i < r; i++)
    target[i] = items[indices[i]];
}
720260
function standardIndexing(selector, maxLen) {
  if (isUndefined(selector) || selector === null) {
    return null;
  }

  // Handle boolean case if applicable
  var boolIdxResult = attemptBoolIndexing(selector, maxLen);
  if (!isUndefined(boolIdxResult)) {
    return boolIdxResult;
  }

  // Handle integer indexing
  var opts = resolverOpts(RESOLVE_MODE.INT, maxLen);
  return resolveSelector(selector, opts);
}
79575
def _index_item(self, uri, num, batch_num):
        

        data = RdfDataset(get_all_item_data(uri, self.namespace),
                          uri).base_class.es_json()
        self.batch_data[batch_num].append(data)
        self.count += 1
328814
function selectIndex(idx){

    // If another item is currently selected, deselect it
    if(selectedItem) selectedItem.className = selectedItem.className.replace(/\s?selected/,'');

    // Grab the search results straight from the DOM
    var r = document.getElementById('searchresults');
    var items = r.childNodes;

    // If we actually have no items, there's not much we can do
    if(items.length === 0){
      selectedSearchIndex = -1;
      selectedItem = false;
      return;
    }

    // Store the item and its index in helper variables
    selectedSearchIndex = idx;
    var s = selectedItem = items[idx];

    // Select the item
    s.className += ' selected';

    // Figure out whether or not the item is fully visible inside
    // the scrollable view, and if not, then scroll appropriately
    var o = s.offsetTop - r.offsetTop - r.scrollTop;
    if(o < 0){
      r.scrollTop = s.offsetTop - r.offsetTop;
    }else if(o > r.offsetHeight - s.offsetHeight){
      r.scrollTop = o + r.scrollTop - r.offsetHeight + s.offsetHeight;
    }
  }
12094
function (item, req, eachReq, res, next) {
          eachReq.item = item;
          eachReq[indexKey] = index;
          index++;
          next();
        }
381081
function ArrayindexOf(thing) {
  var index = 0;
  var count = this.length;
  while (index < count) {
    if (this[index] === thing) return index
    index = index + 1
  }
  return -1
}
592892
function indexProperties(obj) {
	if (!obj)
		return;
	if (obj.propertyMap)
		return;
	obj.propertyMap = new Map;
	obj.properties.forEach(function(prty) {
		obj.propertyMap.put(prty.name, prty);
	})
	if (!obj.prototype)
		return;
	var parent = lookupObject(obj.prototype.key);
	indexProperties(parent)
	parent.propertyMap.forEach(function(name,prty) {
		if (!obj.propertyMap.has(name)) {
			obj.propertyMap.put(name,prty);
		}
	})
}
1248523
function handleItemKeypress(e) {
    const itemIndex = NodeListUtils.findNodeWithFirstChar(this.itemEls, e.key);

    if (itemIndex !== -1) {
        this.rovingTabindex.index = itemIndex;
    }
}
1052981
function indexOf(match) {
        var i = matches.length;
        while (i--) {
          if (matches[i] === match) {
            return i;
          }
        }

        return -1;
      }
785390
function indexWithDescendants(items, index) {
  items.forEach(function(item) {
    item.allShareKeys.forEach(function(key) {
      var insertionKey = key;

      if (index[insertionKey]) {
        insertionKey = generateUniqueKey(index, key);

        if (item.uniqueId === key) {
          // If this duplicate was the item's main key that will be used for sharing it in general, set this
          // to the new key. This means that sharing the item will still work most of the time.
          item.id = insertionKey;
        }

        console.warn(
          "Duplicate shareKey: " +
            key +
            ". Inserting new item under " +
            insertionKey
        );
      }

      index[insertionKey] = item;
    }, this);

    if (defined(item.items)) {
      indexWithDescendants(item.items, index);
    }
  });
}
610176
def index(self, item):
        """"""
        index_at = None
        for (i, child) in enumerate(self._children):
            if child.item == item:
                index_at = i
                break
        if index_at is None:
            raise ValueError("%s is not contained in any child" % (item))
        return index_at
481994
function getIndexOfItemWithTextPrefix(element, prefix) {
  const itemTextContents = getItemTextContents(element);
  const prefixLength = prefix.length;
  for (let i = 0; i < itemTextContents.length; i++) {
    const itemTextContent = itemTextContents[i];
    if (itemTextContent.substr(0, prefixLength) === prefix) {
      return i;
    }
  }
  return -1;
}
855149
function(index) {
        var nextIndex = index + 1;
        if (nextIndex < this.order.length) {
            var nextElement = OpenLayers.Util.getElement(this.order[nextIndex]);
            if (nextElement == undefined) {
                nextElement = this.getNextElement(nextIndex);
            }
            return nextElement;
        } else {
            return null;
        } 
    }