Fulltext search issue

Hi,

Here is my fulltext query - $response = $api->query(
Predicates::fulltext(‘document’, ‘museum’)
);

Only 3 results come back although there are many documents of type press_releases that has museum in their title. Please advise.

Hello @lrmpham!

With that predicate, you’re searching results in all documents. Maybe a specific search in just that Custom type (press_releases) and in a specific field would be more useful?

[fulltext(my.press_releases.title, "museum")] // specific field

Read the full reference about the Fulltext search.

That would work, but I need to search in all documents. This will be used for the search bar on my website to allow the user to search the entire site for something.

I tried your suggestion and it still doesn’t bring back anything. I also tried this:
$response = $api->query(
[ Predicates::at(‘document.type’, ‘press_releases’),
Predicates::fulltext(‘document’, $term) ]
);
and still no results.

Hey,

Can you tell us what kind of fields the other search terms are in? Like a group or a key text field etc.

Thanks.

The field is a simple Title field. I tried what was suggested:
$response = $api->query(
[Predicates::fulltext(‘my.press_releases.page_title’, ‘museum’)]
);
and no documents comes back.
If I try:
$response = $api->query(
[Predicates::fulltext(‘document’, ‘museum’)]
);
only 2 documents comes back.
There are at least 50+ documents with museum in the page_title field.
This seems like a simple search but nothing comes back.
Do you have access to my repo to do testing yourself ?

You can send a private message with the name of your repo to the @Team-Education so we can check it.

Haven’t done this before, but how do I private message you ? :slight_smile:

Click my profile image and then the message button.

The syntax may vary depending on the technology you are using to query, which one are you using?

I have tested the following query in your endpoint and it returns 90 documents:

[fulltext(my.press_releases.page_title, "museum")]

You can also test this by going to your API endpoint: https://your-repo-name.prismic.io/api

Yes, I noticed that results are coming back now so whatever you guys did worked ! Thanks.
When I did a query of all documents, the first one that came back was the Plan Your Visit page. Is it possible the configure the search to put documents with the search term in the Title at the top of the search results ? Thanks.

1 Like

This issue has been closed due to inactivity.