Skip to content

Latest commit

 

History

History
78 lines (52 loc) · 2.06 KB

SearchAPI.md

File metadata and controls

78 lines (52 loc) · 2.06 KB

Search-API

Search Global

        use CTApi\Models\Common\Search\SearchRequest;

        $results = SearchRequest::search("5pm")->get();
        $firstResult = $results[0];

        var_dump( $firstResult->getTitle());
        // Output: "5PM CREW WIKI"

        var_dump( $firstResult->getDomainType());
        // Output: "wiki_page"

        var_dump( $firstResult->getDomainIdentifier());
        // Output: "baae1955-d28f-47b0-8d55-b32ca5174159"

        var_dump( $firstResult->getIcon());
        // Output: "file"

        var_dump( $firstResult->getApiUrl());
        // Output: "https://intern.church.tools/api/wiki/categories/27/pages/baae1955-d28f-47b0-8d55-b32ca5174159/versions/26"

        var_dump( $firstResult->getFrontendUrl());
        // Output: "https://intern.church.tools/wiki/27/main"

        var_dump( $firstResult->getImageUrl());
        // Output: null

        var_dump( $firstResult->getDomainAttributes());
        // Output: []

Search in specific Domain-Types

Available Domain-Types:

  • person
  • group
  • song
  • wiki_page
        use CTApi\Models\Common\Search\SearchRequest;

        $results = SearchRequest::search("5pm")
            ->whereDomainType("wiki_page")
            ->whereDomainType("person")->get();
        $firstResult = $results[0];

        var_dump( $firstResult->getTitle());
        // Output: "5PM CREW WIKI"

        var_dump( $firstResult->getDomainType());
        // Output: "wiki_page"

        var_dump( $firstResult->getDomainIdentifier());
        // Output: "baae1955-d28f-47b0-8d55-b32ca5174159"

        var_dump( $firstResult->getIcon());
        // Output: "file"

        var_dump( $firstResult->getApiUrl());
        // Output: "https://intern.church.tools/api/wiki/categories/27/pages/baae1955-d28f-47b0-8d55-b32ca5174159/versions/26"

        var_dump( $firstResult->getFrontendUrl());
        // Output: "https://intern.church.tools/wiki/27/main"

        var_dump( $firstResult->getImageUrl());
        // Output: null

        var_dump( $firstResult->getDomainAttributes());
        // Output: []