Mark document to retrieve its source from Elasticsearch.
        Returns:
            True - if marking document for the first time in this bulk
            False - if document has been already marked
549677
def should_get_id(self, action):
        
        mapping_ids = self.doc_to_get.setdefault(action["_index"], {}).setdefault(
            action["_type"], set()
        )
        if action["_id"] in mapping_ids:
            # There is an update on this id already
            return False
        else:
            mapping_ids.add(action["_id"])
            return True
1319995
def mark_as_read(self):
        
        if self.object_id is None or self.__is_draft:
            raise RuntimeError('Attempting to mark as read an unsaved Message')

        data = {self._cc('isRead'): True}

        url = self.build_url(
            self._endpoints.get('get_message').format(id=self.object_id))

        response = self.con.patch(url, data=data)
        if not response:
            return False

        self.__is_read = True

        return True
997375
def search(self, query=None, size=100, unpack=True):
        
        logging.info('Download all documents from index %s.', self.index)
        if query is None:
            query = self.match_all
        results = list()
        data = self.instance.search(index=self.index, doc_type=self.doc_type, body=query, size=size)
        if unpack:
            for items in data['hits']['hits']:
                if '_source' in items:
                    results.append(items['_source'])
                else:
                    results.append(items)
        else:
            results = data['hits']['hits']
        return results
68441
def indent(self):
        

        cursor = self.textCursor()
        if not cursor.hasSelection():
            cursor.insertText(self.__indent_marker)
        else:
            block = self.document().findBlock(cursor.selectionStart())
            while True:
                block_cursor = self.textCursor()
                block_cursor.setPosition(block.position())
                block_cursor.insertText(self.__indent_marker)
                if block.contains(cursor.selectionEnd()):
                    break
                block = block.next()
        return True
616356
def check_token(self):
        
        try:
            doc = self.doc_ref.get()
        except Exception as e:
            log.error('Token (collection: {}, doc_id: {}) '
                      'could not be retrieved from the backend: {}'
                      .format(self.collection, self.doc_id, str(e)))
            doc = None
        return doc and doc.exists
992246
def save_token(self):
        
        if self.token is None:
            raise ValueError('You have to set the "token" first.')

        try:
            # set token will overwrite previous data
            self.doc_ref.set({
                self.field_name: self.serializer.dumps(self.token)
            })
        except Exception as e:
            log.error('Token could not be saved: {}'.format(str(e)))
            return False

        return True
443964
boolean documentReturn(String description) {
    if (!lazyInitDocumentation()) {
      return true;
    }

    if (documentation.returnDescription != null) {
      return false;
    }

    documentation.returnDescription = description;
    return true;
  }
481386
boolean doResetCheck() {
    if(documents.isEmpty() || (documents.size() > 1 && noMultiReset)) {
      return false;
    }
    return documents.get(docNum).doresetCheck();
  }
105941
private boolean goToNextDoc() throws IOException {
    if (docId == NO_MORE_DOCS) {
      return true;
    } else {
      int spans1DocId = spans1.spans.nextDoc();
      int spans2DocId = spans2.spans.docID();
      docId = Math.max(spans1DocId, spans2DocId);
      while (spans1DocId != spans2DocId && docId != NO_MORE_DOCS) {
        if (spans1DocId < spans2DocId) {
          spans1DocId = spans1.spans.advance(spans2DocId);
          docId = spans1DocId;
        } else {
          spans2DocId = spans2.spans.advance(spans1DocId);
          docId = spans2DocId;
        }
      }
      if (docId != NO_MORE_DOCS && !goToNextStartPosition()) {
        reset();
        return false;
      } else {
        return true;
      }
    }
  }
1110832
private boolean goToNextDoc() throws IOException {
    reset();
    if (docId == NO_MORE_DOCS) {
      minPosition = NO_MORE_POSITIONS;
      maxPosition = NO_MORE_POSITIONS;
      return true;
    } else {
      docId = subSpans.nextDoc();
      if (docId == NO_MORE_DOCS) {
        minPosition = NO_MORE_POSITIONS;
        maxPosition = NO_MORE_POSITIONS;
        return true;
      } else {
        IndexDoc doc = mtasCodecInfo.getDoc(field, docId);
        if (doc != null) {
          minPosition = doc.minPosition;
          maxPosition = doc.maxPosition;
        } else {
          minPosition = NO_MORE_POSITIONS;
          maxPosition = NO_MORE_POSITIONS;
        }
        if (goToNextStartPosition()) {
          return true;
        } else {
          return false;
        }
      }
    }
  }
83733
def add_upsert(self, action, meta_action, doc_source, update_spec):
        

        # Whenever update_spec is provided to this method
        # it means that doc source needs to be retrieved
        # from Elasticsearch. It means also that source
        # is not stored in local buffer
        if update_spec:
            self.bulk_index(action, meta_action)

            # -1 -> to get latest index number
            # -1 -> to get action instead of meta_action
            # Update document based on source retrieved from ES
            self.add_doc_to_update(action, update_spec, len(self.action_buffer) - 2)
        else:
            # Insert and update operations provide source
            # Store it in local buffer and use for comming updates
            # inside same buffer
            # add_to_sources will not be called for delete operation
            # as it does not provide doc_source
            if doc_source:
                self.add_to_sources(action, doc_source)
            self.bulk_index(action, meta_action)
1102234
def find_doc(self, name=None, ns_uri=None, first_only=False):
        
        return self.document.find(name=name, ns_uri=ns_uri,
            first_only=first_only)
401165
def get_new_document(self, cursor_pos=None):
        
        lines = []

        # Original text, before cursor.
        if self.original_document.text_before_cursor:
            lines.append(self.original_document.text_before_cursor)

        # Selected entries from the history.
        for line_no in sorted(self.selected_lines):
            lines.append(self.history_lines[line_no])

        # Original text, after cursor.
        if self.original_document.text_after_cursor:
            lines.append(self.original_document.text_after_cursor)

        # Create `Document` with cursor at the right position.
        text = '\n'.join(lines)
        if cursor_pos is not None and cursor_pos > len(text):
            cursor_pos = len(text)
        return Document(text, cursor_pos)
1255298
def mark(self, index):
        
        if index < self.start:
            Log.error("Can not go in reverse on stream")
        if self._mark != -1:
            Log.error("Not expected")
        self._mark = index
1010409
public boolean hasNext() {
		if(done) return false;
		if(cachedNext != null) {
			return true;
		}
		while(inner.hasNext()) {
			String tmp = inner.next();
			if(tmp.startsWith(prefix)) {
				cachedNext = tmp;
				return true;
			} else if(tmp.compareTo(prefix) > 0) {
				done = true;
				return false;
			}
		}
		return false;
	}
991156
function _mapDocumentToSource(source) {
        var node = exports.root;
        DOMHelpers.eachNode(source, function each(payload) {
            if (!node) {
                return true;
            }
            if (payload.closing) {
                var parent = node.findParentForNextNodeMatchingPayload(payload);
                if (!parent) {
                    return console.warn("Matching Parent not at " + payload.sourceOffset + " (" + payload.nodeName + ")");
                }
                parent.closeLocation = payload.sourceOffset;
                parent.closeLength = payload.sourceLength;
            } else {
                var next = node.findNextNodeMatchingPayload(payload);
                if (!next) {
                    return console.warn("Skipping Source Node at " + payload.sourceOffset);
                }
                node = next;
                node.location = payload.sourceOffset;
                node.length = payload.sourceLength;
                if (payload.closed) {
                    node.closed = payload.closed;
                }
            }
        });
    }
313336
def commit(self):
        

        # Get the number of lines and columns in last line.
        last_line, last_col = self.qteWidget.getNumLinesAndColumns()

        # If this is the first ever call to this undo/redo element
        # then backup the current cursor- and marker position because
        # both will be required for the redo operation.
        if self.cursorPos is None:
            # Get the default marker and ensure it points to a
            # valid location inside the document.
            self.markerPos = self.qteWidget.qteGetMark()
            if self.markerPos is None:
                return
            if not self.qteWidget.isPositionValid(*self.markerPos):
                return

            # Backup the current cursor and marker position; swap
            # one for the other if necessary to ensure the marker
            # comes first.
            self.cursorPos = self.qteWidget.getCursorPosition()
            if self.cursorPos[0] < self.markerPos[0]:
                self.cursorPos, self.markerPos = self.markerPos, self.cursorPos

        # Insert the specified string at the same position in every line
        # in between the mark and the cursor (inclusive).
        col = min((self.markerPos[1], self.cursorPos[1]))
        for line in range(self.markerPos[0], self.cursorPos[0] + 1):
            self.baseClass.insertAt(self.text, line, col)

        self.qteWidget.setCursorPosition(*self.cursorPos)