vendredi 2 mars 2018

How do I set Algolia to not return any results if the query is blank Laravel & Vue Instant Search

hey I use algolia on my new Laravel project but I get into this that algolia displays all data that I have " Titel - description ".

what I want is only display result when I type something in the search box.

my Html Code

<div id="app">
    <!-- Components will go here -->
    <ais-index app-id=""
               api-key=""
               index-name="posts">

        <ais-search-box placeholder="Find products..."></ais-search-box>


        <ais-results>
            <template slot-scope="{ result }">
                <div>

                    <h4>@</h4>
                    <ul>
                        <li>@</li>
                    </ul>
                </div>
            </template>
        </ais-results>

    </ais-index>
</div>

Post Model

  <?php

  namespace App;

  use Illuminate\Database\Eloquent\Model;
  use Laravel\Scout\Searchable;

  class Post extends Model
     {
        //
         use Searchable;

     }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire