Returns which field the search index has marked as it's
        `document=True` field.
554687
def get_document_field(instance):
        
        for name, field in instance.searchindex.fields.items():
            if field.document is True:
                return name
430476
def find_field_by_name(browser, field_type, name):
    
    return ElementSelector(
        browser,
        field_xpath(field_type, 'name') %
        string_literal(name),
        filter_displayed=True,
    )
1249400
def search(self):
        
        params = self.solr_params()
        logging.info("PARAMS=" + str(params))
        results = self.solr.search(**params)
        logging.info("Docs found: {}".format(results.hits))
        return self._process_search_results(results)
1037345
def search_document_cache_key(self):
        """"""
        return "elasticsearch_django:{}.{}.{}".format(
            self._meta.app_label, self._meta.model_name, self.pk
        )
673595
public boolean isSolrSearch() {

        if (VFS.equals(m_source)) {
            // VFS search selected
            return false;
        }
        // index selected and query entered --> Solr search else VFS
        return (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_source)
            && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_query));
    }
377775
def get_document_field_display(self, field_name, field):
        
        document = getattr(self.instance, field_name)
        if document:
            return mark_safe(
                '<a href="%s">%s <span class="meta">(%s, %s)</span></a>' % (
                    document.url,
                    document.title,
                    document.file_extension.upper(),
                    filesizeformat(document.file.size),
                )
            )
        return self.model_admin.get_empty_value_display()
347450
private boolean matchesField(Format.Field attribute) {
        if (this.attribute != null) {
            return this.attribute.equals(attribute);
        }
        return false;
    }
1275805
def index(self, index, field, value):
        ""
        params = {
            "q": value,
            # search index has '_' instead of '-' in field names ..
            "q.options": "{fields:['%s']}" % (field.replace('-', '_'))
        }

        response = self.get(self.config(index, 'search_url'), params=params)
        results = [hit['fields'] for hit in response.json()['hits']['hit']]

        for result in results:
            for key in result:
                result[key.replace('_', '-')] = result.pop(key)

        return results
300402
def fetch_search_document(self, *, index):
        """"""
        assert self.pk, "Object must have a primary key before being indexed."
        client = get_client()
        return client.get(index=index, doc_type=self.search_doc_type, id=self.pk)
1347612
def search(query, index=INDEX_NAME, doc_type=DOC_TYPE):
    
    results = raw_query(query, index=index, doc_type=doc_type)
    return [r['_source'] for r in results]
573759
def apply(self, search, field, value):
        """"""
        # We assume that the field in question has a "raw" counterpart.
        return search.query('match', **{'{}.raw'.format(field): value})
630928
def visit_exact_match_value(self, node, fieldnames=None):
        """"""
        if not fieldnames:
            fieldnames = ['_all']
        else:
            fieldnames = force_list(fieldnames)

        if ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['exact-author'] == fieldnames[0]:
            return self._generate_exact_author_query(node.value)

        elif ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['type-code'] == fieldnames[0]:
            return self._generate_type_code_query(node.value)

        elif ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['journal'] == fieldnames:
            return self._generate_journal_nested_queries(node.value)

        bai_fieldnames = self._generate_fieldnames_if_bai_query(
            node.value,
            bai_field_variation=FieldVariations.raw,
            query_bai_field_if_dots_in_name=False
        )

        if ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['date'] == fieldnames:
            term_queries = []
            for field in fieldnames:
                term_query =  \
                    {'term': {field: _truncate_date_value_according_on_date_field(field, node.value).dumps()}}

                term_queries.append(
                    generate_nested_query(ElasticSearchVisitor.DATE_NESTED_QUERY_PATH, term_query)
                    if field in ElasticSearchVisitor.DATE_NESTED_FIELDS
                    else term_query
                )
        elif ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['author'] in fieldnames:
            term_queries = [
                generate_nested_query(ElasticSearchVisitor.AUTHORS_NESTED_QUERY_PATH, {'term': {field: node.value}})
                for field in (bai_fieldnames or fieldnames)
            ]
        else:
            term_queries = [{'term': {field: node.value}} for field in (bai_fieldnames or fieldnames)]

        return wrap_queries_in_bool_clauses_if_more_than_one(term_queries, use_must_clause=False)
1043461
public   MapSearchHit getDocumentHit(String indexName, String indexType,String documentId,Map<String,Object> options) throws ElasticSearchException{
		try {
			MapSearchHit searchResult = this.client.executeRequest(BuildTool.buildGetDocumentRequest(indexName, indexType, documentId, options), null, new GetDocumentHitResponseHandler(), ClientUtil.HTTP_GET);
			return searchResult;
		}
		catch(ElasticSearchException e){
			return ResultUtil.hand404HttpRuntimeException(e,MapSearchHit.class,ResultUtil.OPERTYPE_getDocument);
		}
	}
822131
public function getSearchableFieldsString()
    {
        if (!empty($this->searchableFieldsString)) {
            return $this->searchableFieldsString;
        }

        $searchableFieldsMeta = $this->getSearchableFieldsMeta();
        if (empty($searchableFieldsMeta)) {
            return false;
        }

        $this->searchableFieldsString = array_map(function (PropertyContract $property) {
            return $property->getField();
        }, $searchableFieldsMeta);

        return $this->searchableFieldsString;
    }
444162
def _percolate_query(index, doc_type, percolator_doc_type, document):
    """"""
    if ES_VERSION[0] in (2, 5):
        results = current_search_client.percolate(
            index=index, doc_type=doc_type, allow_no_indices=True,
            ignore_unavailable=True, body={'doc': document}
        )
        return results['matches']
    elif ES_VERSION[0] == 6:
        results = current_search_client.search(
            index=index, doc_type=percolator_doc_type, allow_no_indices=True,
            ignore_unavailable=True, body={
                'query': {
                    'percolate': {
                        'field': 'query',
                        'document_type': percolator_doc_type,
                        'document': document,
                    }
                }
            }
        )
        return results['hits']['hits']
516802
def get_from_search_doc(cls, doc_id):
        
        # If the document was passed instead of the doc_id, get the document.
        if hasattr(doc_id, 'doc_id'):
            doc_id = doc_id.doc_id
        return cls.from_urlsafe(doc_id)
1192867
def hasField(self, name):
        
        if self._autoFixNames:
            name = self._fixName(name)
        return self._fieldAttrDict.has_key(name)