%PDF- %PDF-
Direktori : /home/graphicd/www/vebto/vendor/meilisearch/meilisearch-php/ |
Current File : /home/graphicd/www/vebto/vendor/meilisearch/meilisearch-php/.code-samples.meilisearch.yaml |
# This code-samples file is used by the MeiliSearch documentation # Every example written here will be automatically fetched by # the documentation on build # You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples --- get_one_index_1: |- $client->index('movies')->fetchRawInfo(); list_all_indexes_1: |- $client->getAllIndexes(); create_an_index_1: |- $client->createIndex('movies', ['primaryKey' => 'movie_id']); update_an_index_1: |- $client->updateIndex('movies', ['primaryKey' => 'movie_id']); // OR $client->index('movies')->update(['primaryKey' => 'movie_id']); delete_an_index_1: |- $client->deleteIndex('movies'); // OR $client->index('movies')->delete(); get_one_document_1: |- $client->index('movies')->getDocument(25684); get_documents_1: |- $client->index('movies')->getDocuments(['limit' => 2]); add_or_replace_documents_1: |- $client->index('movies')->addDocuments([ [ 'id' => 287947 'title' => 'Shazam', 'poster' => 'https://image.tmdb.org/t/p/w1280/xnopI5Xtky18MPhK40cZAGAOVeV.jpg', 'overview' => 'A boy is given the ability to become an adult superhero in times of need with a single magic word.', 'release_date' => '2019-03-23' ] ]); add_or_update_documents_1: |- $client->index('movies')->updateDocuments([ [ 'id' => 287947 'title' => 'Shazam ⚡️', 'genres' => 'comedy' ] ]); delete_all_documents_1: |- $client->index('movies')->deleteAllDocuments(); delete_one_document_1: |- $client->index('movies')->deleteDocument(25684); delete_documents_1: |- $client->index('movies')->deleteDocuments([23488, 153738, 437035, 363869]); search_post_1: |- // Do a search $searchResults = $client->index('movies')->search('american ninja'); // Get results in an Array using a getter $hits = $searchResults->getHits(); // Get the decoded response of MeiliSearch, see response below $response = $searchResults->getRaw(); get_update_1: |- $client->index('movies')->getUpdateStatus(1); get_all_updates_1: |- $client->index('movies')->getAllUpdateStatus(); get_keys_1: |- $client->getKeys(); get_settings_1: |- $client->index('movies')->getSettings(); update_settings_1: |- $client->index('movies')->updateSettings([ 'rankingRules' => [ 'typo', 'words', 'proximity', 'attribute', 'wordsPosition', 'exactness', 'desc(release_date)', 'desc(rank)' ], 'distinctAttribute' => 'movie_id', 'searchableAttributes' => [ 'title', 'description', 'genre' ], 'displayedAttributes' => [ 'title', 'description', 'genre', 'release_date' ], 'stopWords' => [ 'the', 'a', 'an' ], 'synonyms' => [ 'wolverine': ['xmen', 'logan'], 'logan': ['wolverine'] ] ]); reset_settings_1: |- $client->index('movies')->resetSettings(); get_synonyms_1: |- $client->index('movies')->getSynonyms(); update_synonyms_1: |- $client->index('movies')->updateSynonyms([ 'wolverine': ['xmen', 'logan'], 'logan': ['wolverine', 'xmen'], 'wow': ['world of warcraft'] ]); reset_synonyms_1: |- $client->index('movies')->resetSynonyms(); get_stop_words_1: |- $client->index('movies')->getStopWords(); update_stop_words_1: |- $client->index('movies')->updateStopWords(['the', 'of', 'to']); reset_stop_words_1: |- $client->index('movies')->resetStopWords(); get_ranking_rules_1: |- $client->index('movies')->getRankingRules(); update_ranking_rules_1: |- $client->index('movies')->updateRankingRules([ 'typo', 'words', 'proximity', 'attribute', 'wordsPosition', 'exactness', 'asc(release_date)', 'desc(rank)' ]); reset_ranking_rules_1: |- $client->index('movies')->resetRankingRules(); get_distinct_attribute_1: |- $client->index('movies')->getDistinctAttribute(); update_distinct_attribute_1: |- $client->index('movies')->updateDistinctAttribute('movie_id'); reset_distinct_attribute_1: |- $client->index('movies')->resetDistinctAttribute(); get_searchable_attributes_1: |- $client->index('movies')->getSearchableAttributes(); update_searchable_attributes_1: |- $client->index('movies')->updateSearchableAttributes([ 'title', 'description', 'genre' ]); reset_searchable_attributes_1: |- $client->index('movies')->resetSearchableAttributes(); get_attributes_for_faceting_1: |- $client->index('movies')->getAttributesForFaceting(); update_attributes_for_faceting_1: |- $client->index('movies')->updateAttributesForFaceting([ 'genres', 'director' ]); reset_attributes_for_faceting_1: |- $client->index('movies')->resetAttributesForFaceting(); get_displayed_attributes_1: |- $client->index('movies')->getDisplayedAttributes(); update_displayed_attributes_1: |- $client->index('movies')->updateDisplayedAttributes([ 'title', 'description', 'genre', 'release_date' ]); reset_displayed_attributes_1: |- $client->index('movies')->resetDisplayedAttributes(); get_index_stats_1: |- $client->index('movies')->stats(); get_indexes_stats_1: |- $client->stats(); get_health_1: |- $client->health(); get_version_1: |- $client->version(); distinct_attribute_guide_1: |- $client->index('jackets')->updateDistinctAttribute('product_id'); field_properties_guide_searchable_1: |- $client->index('movies')->updateSearchableAttributes([ 'title', 'description', 'genre' ]); field_properties_guide_displayed_1: |- $client->index('movies')->updateDisplayedAttributes([ 'title', 'description', 'genre', 'release_date' ]); filtering_guide_1: |- $client->index('movies')->search('Avengers', ['filters' => 'release_date > 795484800']); filtering_guide_2: |- $client->index('movies')->search('Avengers', ['filters' => 'release_date > 795484800 AND (director = "Tim Burton" OR director = "Christopher Nolan")']); filtering_guide_3: |- $client->index('movies')->search('horror', ['filters' => 'director = "Jordan Peele"']); filtering_guide_4: |- $client->index('movies')->search('Planet of the Apes', ['filters' => 'rating >= 3 AND (NOT director = "Tim Burton")']); search_parameter_guide_query_1: |- $client->index('movies')->search('shifu'); search_parameter_guide_offset_1: |- $client->index('movies')->search('shifu', ['offset' => 1]); search_parameter_guide_limit_1: |- $client->index('movies')->search('shifu', ['limit' => 1]); search_parameter_guide_retrieve_1: |- $client->index('movies')->search('shifu', ['attributesToRetrieve' => ['overview', 'title']]); search_parameter_guide_crop_1: |- $client->index('movies')->search('shifu', ['attributesToCrop' => ['overview'], 'cropLength' => 10]); search_parameter_guide_highlight_1: |- $client->index('movies')->search('shifu', ['attributesToHighlight' => ['overview']]); search_parameter_guide_filter_1: |- $client->index('movies')->search('n', ['filters' => 'title = Nightshift']); search_parameter_guide_filter_2: |- $client->index('movies')->search('shifu', ['filters' => 'title="Kung Fu Panda"']); search_parameter_guide_matches_1: |- $client->index('movies')->search('shifu', ['attributesToHighlight' => ['overview'], 'matches' => true]); settings_guide_synonyms_1: |- $client->index('tops')->updateSynonyms(['sweater' => ['jumper'], 'jumper' => ['sweater']]); settings_guide_stop_words_1: |- $client->index('movies')->updateStopWords(['the', 'a', 'an']); settings_guide_ranking_rules_1: |- $client->index('movies')->updateRankingRules([ 'typo', 'words', 'proximity', 'attribute', 'wordsPosition', 'exactness', 'asc(release_date)', 'desc(rank)' ]); settings_guide_distinct_1: |- $client->index('jackets')->updateDistinctAttribute('product_id'); settings_guide_searchable_1: |- $client->index('movies')->updateSearchableAttributes([ 'title', 'description', 'genre' ]); settings_guide_displayed_1: |- $client->index('movies')->updateDisplayedAttributes([ 'title', 'description', 'genre', 'release_date' ]); add_movies_json_1: |- $moviesJson = file_get_contents('movies.json'); $movies = json_decode($moviesJson); $client->index('movies')->addDocuments($movies) documents_guide_add_movie_1: |- $client->index('movies')->addDocuments([['movie_id' => '123sq178', 'title' => 'Amelie Poulain']]); search_guide_1: |- $client->index('movies')->search('shifu', ['limit' => 5, 'offset' => 10]); search_guide_2: |- $client->index('movies')->search('Avengers', ['filters' => 'release_date > 795484800']); getting_started_add_documents_md: |- Using `meilisearch-php` with the Guzzle HTTP client: ```bash composer require meilisearch/meilisearch-php \ guzzlehttp/guzzle \ http-interop/http-factory-guzzle:^1.0 ``` ```php <?php require_once __DIR__ . '/vendor/autoload.php'; use MeiliSearch\Client; $client = new Client('http://127.0.0.1:7700'); $movies_json = file_get_contents('movies.json'); $movies = json_decode($movies_json); $client->index('movies')->addDocuments($movies); ``` [About this SDK](https://github.com/meilisearch/meilisearch-php/) getting_started_search_md: |- ```php $index->search('botman'); ``` [About this SDK](https://github.com/meilisearch/meilisearch-php/) faceted_search_update_settings_1: |- $client->index('movies')->updateAttributesForFaceting(['director', 'genres']); faceted_search_facet_filters_1: |- $client->index('movies')->search('thriller', ['facetFilters' => [['genres:Horror', 'genres:Mystery']], 'director' => "Jordan Peele"']); faceted_search_facets_distribution_1: |- $client->index('movies')->search('Batman', ['facetsDistribution' => ['genres']]); faceted_search_walkthrough_attributes_for_faceting_1: |- $client->index('movies')->updateAttributesForFaceting([ 'director', 'producer', 'genres', 'production_companies' ]); faceted_search_walkthrough_facet_filters_1: |- $client->index('movies')->search('thriller', ['facetFilters' => [['genres:Horror', 'genres:Mystery']], 'director' => "Jordan Peele"]); faceted_search_walkthrough_facets_distribution_1: |- $client->index('movies')->search('Batman', ['facetsDistribution' => ['genres']); post_dump_1: |- $client->createDump(); get_dump_status_1: |- $client->getDumpStatus('20201101-110357260');