Instantiate the search form, primarily outside the search page.

@parameter <{REQUEST}> http request
@parameter <{DISPLAY_SORTING}> boolean
@return search form
503228
public function getSearchForm($request = null, $sorting = false) {

		// Instantiate the search form, primarily excluding the sorting selection.

		$form = $this->getForm($request, $sorting);
		if($form) {

			// When the search form is displayed twice, this prevents a duplicate element ID.

			$form->setName('getSearchForm');

			// Replace the search title with a placeholder.

			$search = $form->Fields()->dataFieldByName('Search');
			$search->setAttribute('placeholder', $search->Title());
			$search->setTitle(null);
		}

		// Allow extension customisation.

		$this->extend('updateExtensibleSearchSearchForm', $form);
		return $form;
	}
302885
public ActionForm getFirstOutputForm( HttpServletRequest request )
    {
        if ( _outputForms == null || _outputForms.size() == 0 )
        {
            if ( _outputFormBeanType != null )
            {
                try
                {
                    if ( _log.isDebugEnabled() )
                    {
                        _log.debug( "Creating form bean of type " + _outputFormBeanType );
                    }
                    
                    ServletContext servletContext = InternalUtils.getServletContext( request );
                    ReloadableClassHandler rch = Handlers.get( servletContext ).getReloadableClassHandler();
                    Object formBean = rch.newInstance( _outputFormBeanType );
                    ActionForm wrappedFormBean = InternalUtils.wrapFormBean( formBean );
                    addOutputForm( wrappedFormBean );
                    return wrappedFormBean;
                }
                catch ( Exception e )
                {
                    _log.error( "Could not create form bean instance of " + _outputFormBeanType, e );
                }                
            }
            
            return null;
        }
        else
        {
            return ( ActionForm ) _outputForms.get( 0 );
        }
    }
1254067
private function createHttpRequest(SearchRequest $getRequest)
    {
        $resquest = $this->createQueryRequest('GET', $getRequest->index);
        $query    = $resquest->getQuery();

        $query->add('q', $getRequest->q);
        $query->add('wt', 'json');

        if ($getRequest->presort != null) {
            $query->add('presort', $getRequest->presort);
        }

        if ($getRequest->sort != null) {
            $query->add('sort', $getRequest->sort);
        }

        if ($getRequest->start != null) {
            $query->add('start', $getRequest->start);
        }

        if ($getRequest->rows != null) {
            $query->add('rows', $getRequest->rows);
        }

        if ($getRequest->op != null) {
            $query->add('op', $getRequest->op);
        }

        if ($getRequest->fl != null) {
            $query->add('fl', implode(',', $getRequest->fl));
        }

        if ($getRequest->df != null) {
            $query->add('df', $getRequest->df);
        }

        if ($getRequest->filter != null) {
            $query->add('fq', $getRequest->filter);
        }

        return $resquest;
    }
197983
public static HttpServletRequest getHttpServletRequestFromExternalWebflowContext() {
        val servletExternalContext = (ServletExternalContext) ExternalContextHolder.getExternalContext();
        if (servletExternalContext != null) {
            return (HttpServletRequest) servletExternalContext.getNativeRequest();
        }
        return null;

    }
593735
public function createRequest()
    {
        if ($this->request == null){
            $this->request = Request::fromPhpContext($this);
        }

        return $this->request;
    }
312574
protected function createComponentEditForm(): Form
	{
		$form = $this->formFactory->create();

		$form->addHidden('parent');

		$form->addCheckbox('isLink', 'webManager.web.pages.isLink')
			->setOption('id', 'page-isLink')
			->addCondition($form::EQUAL, false)
			->toggle('page-title')
			->toggle('page-keywords')
			->toggle('page-image')
			->toggle('page-background')
			->toggle('page-description')
			->toggle('page-content')
			->toggle('page-homePage');

		$homePage = $form->addCheckbox('homePage', 'webManager.web.pages.homePage')
			->setOption('id', 'page-homePage')
			->setDisabled(!$this->editHomePage);
		$homePage->addCondition($form::EQUAL, false)
			->toggle('page-name')
			->toggle('page-url')
			->toggle('page-views')
			->toggle('page-isLink');
		if ($homePage->isDisabled()) {
			$homePage->setOption('class', 'hidden');
		}

		$form->addText('name', 'webManager.web.pages.name')
			->setOption('id', 'page-name')
			->addConditionOn($form['homePage'], $form::EQUAL, false)
			->setRequired();

		$form->addText('url', 'default.url')
			->setOption('id', 'page-url')
			->addConditionOn($form['isLink'], $form::EQUAL, true)
			->setRequired();

		$form->addSelectUntranslated('locale', 'webManager.web.pages.locale')
			->setItems($this->localeService->allowed);

		$form->addCheckboxListUntranslated('views', 'webManager.web.pages.views.title')
			->setOption('id', 'page-views')
			->setItems($this->orm->pagesViews->fetchPairsById());

		$form->addText('title', 'webManager.web.pages.pageTitle')
			->setOption('id', 'page-title')
			->setRequired(false)
			->addRule(Form::MAX_LENGTH, null, 150);

		$form->addTextArea('keywords', 'webManager.web.pages.keywords')
			->setOption('id', 'page-keywords')
			->setRequired(false)
			->addRule(Form::MAX_LENGTH, null, 255);

		$form->addImageUpload('image', 'webManager.web.pages.photo', 'webManager.web.pages.photoDelete')
			->setNamespace('pages')
			->setPreview('300x100')
			->setOption('id', 'page-image');

		$form->addColor('background', 'webManager.web.pages.background')
			->setOption('id', 'page-background');

		$form->addTextArea('description', 'webManager.web.pages.description')
			->setOption('id', 'page-description')
			->setRequired(false)
			->addRule(Form::MAX_LENGTH, null, 255);

		$form->addTextEditor('content', 'webManager.web.pages.content')
			->setOption('id', 'page-content');

		$form->addSubmit('save', 'form.save');

		$form->addLink('back', 'form.back', $this->getBacklink());

		$form->onSuccess[] = [$this, 'editFormSucceeded'];

		return $form;
	}
827487
private PagedSearchResult postImageSearch(UploadSearchParams uploadSearchParams, String endpointMethod) {
        ViSearchHttpResponse response = getPostImageSearchHttpResponse(uploadSearchParams, endpointMethod);
        return getPagedResult(response);
    }
326695
@Override
    public PagedSearchResult discoverSearch(UploadSearchParams uploadSearchParams) {
        try {
            return postImageSearch(uploadSearchParams, ENDPOINT_DISCOVER_SEARCH);
        } catch (InternalViSearchException e) {
            return new PagedSearchResult(e.getMessage(), e.getCause(), e.getServerRawResponse());
        }
    }
343176
public RequestCreator nextPage() {
		Request request = data.build();
		String url = request.url;
		int page = request.page;

		if(request.search != null)
			url += "?s=" + request.search;

		Map<String, Integer> pageTracker = singleton.getPageTracker();
		if(pageTracker.containsKey(url))
			page = pageTracker.get(url);

		this.data.page(page + 1);
		return this;
	}
982447
public SearchResponse search(SearchRequest request) {
    return call(
      new GetRequest(path("search"))
        .setParam("gateId", request.getGateId())
        .setParam("organization", request.getOrganization())
        .setParam("page", request.getPage())
        .setParam("pageSize", request.getPageSize())
        .setParam("query", request.getQuery())
        .setParam("selected", request.getSelected()),
      SearchResponse.parser());
  }
25674
private function searchByPost()
    {
        return static function (callable $handler) {
            return function (
                CommandInterface $c,
                RequestInterface $r = null
            ) use ($handler) {
                if ($c->getName() !== 'Search') {
                    return $handler($c, $r);
                }
                return $handler($c, self::convertGetToPost($r));
            };
        };
    }
1230793
function (searchbar) {
        var that = this;
        var button = searchbar.querySelector('button[type=submit]');
        var search = searchbar.querySelector('input[type=search]');

        if (typeof button === 'undefined') {
            return searchbar;
        }

        button.onclick = function (ev) {
            ev.preventDefault();
            that.emitter.emit('search-request', search);
        };

        return searchbar;
    }
138259
public function get_search_form()
    {
        $data = [];

        if (\function_exists('random_int')) {
            try {
                $data['searchform_id'] = 'search_' . \random_int(1000, 8000);
            } catch (\Exception $e) {
                // Fail silently.
            }
        }

        if (! isset($data['searchform_id'])) {
            $data = [
                'searchform_id' => \uniqid('search_', true),
            ];
        }

        \ob_start();
        View::partial('searchform', $data);
        $form = \ob_get_clean();

        return $form;
    }
1177418
public function SearchForm()
    {
        $searchText = '';
        if ($this->owner->getRequest() && $this->owner->getRequest()->getVar('Search')) {
            $searchText = $this->owner->getRequest()->getVar('Search');
        }

        $placeholder = _t('SilverStripe\\CMS\\Search\\SearchForm.SEARCH', 'Search');
        $fields = FieldList::create(
            TextField::create('Search', false, $searchText)
                ->setAttribute('placeholder', $placeholder)
        );
        $actions = FieldList::create(
            FormAction::create('results', _t('SilverStripe\\CMS\\Search\\SearchForm.GO', 'Go'))
        );
        /** @skipUpgrade */
        $form = SearchForm::create($this->owner, 'SearchForm', $fields, $actions);
        $form->classesToSearch(FulltextSearchable::get_searchable_classes());
        return $form;
    }
1308755
public function createRequest()
    {
        return $this->httpClient->createRequest(
            $this->getMethod(),
            $this->getUrl(),
            $this->getPreparedHeaders(),
            $this->getPreparedData()
        );
    }
1316507
public static function get_entries_by_search_returns() {
        return new external_single_structure(array(
            'count' => new external_value(PARAM_INT, 'The total number of records matching the request.'),
            'entries' => new external_multiple_structure(
                self::get_entry_return_structure()
            ),
            'ratinginfo' => \core_rating\external\util::external_ratings_structure(),
            'warnings' => new external_warnings()
        ));
    }
326160
public function search()
    {
        if (request()->get('query') == "") {
            return $this->reset();
        }
        
        session()->put($this->getSearchableKey(), request()->get('query'));

        if (request()->redirectUri) {
            return redirect()->to(request()->redirectUri);
        }

        return redirect()->to($this->previousUrl());
    }