Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please provide a small example for search with service #191

Closed
3PSY0N opened this issue Jul 7, 2022 · 2 comments
Closed

Please provide a small example for search with service #191

3PSY0N opened this issue Jul 7, 2022 · 2 comments
Labels
support Issues related to support questions.

Comments

@3PSY0N
Copy link

3PSY0N commented Jul 7, 2022

Hello

I'd like to make a basic search for my icons
Here's my code :

    #[Route('/search', name: 'app_search')]
    public function search(SearchService $searchService, Request $request, EntityManagerInterface $entityManager)
    {
        $searchQuery = $request->query->get('q');
        if (empty($searchQuery)) return $this->redirectToRoute('app_home');

        $hits = $searchService->rawSearch(Icon::class, $searchQuery)["hits"];
        dd($hits);
    }

This isn't optimal, I'm sure there is a way to search directly but I don't found anything in the documentation.

When I do this, I found 0 hits :

$hits = $searchService->search($entityManager, Icon::class, $searchQuery)

Can you provide a small example to how to do a basic search with SearchService

Thank you

@brunoocasali brunoocasali added the support Issues related to support questions. label Jul 11, 2022
@brunoocasali
Copy link
Member

Hi, @3PSY0N thanks for using Meilisearch!

Before entering your specific request, did you index the data? For example, can you usually search through the documents in a CURL/Postman request?

@brunoocasali
Copy link
Member

Hi @3PSY0N I've created a small example of how you can use this bundle here: https://github.com/meilisearch/meilisearch-symfony/wiki/Searching-with-Meilisearch-Bundle

Let me know if you need anything!

Thanks for using Meilisearch ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Issues related to support questions.
Projects
None yet
Development

No branches or pull requests

2 participants