• Hi, I’m getting no results on each query. I’m self hosting and I have managed to index all the posts and I can do a search query via a shell command, but I can’t get it to work in WordPress. I am trying to replace search with the autocomplete option.

    This is from my error log:

    === START ====
    ::Time:: 2022-12-22::15:51:41-UTC
    WP_Error::__set_state(array(
       'errors' => 
      array (
        404 => 
        array (
          0 => 'Not Found : Not Found',
        ),
      ),
       'error_data' => 
      array (
      ),
       'additional_data' => 
      array (
      ),
    ))
    ===END===
    

    Also I’m getting these errors:

    [22-Dec-2022 15:44:34 UTC] PHP Warning:  Undefined property: WP_Error::$fields in /home/xxxxxxx/htdocs/xxxxxxx.com/wp-content/plugins/search-with-typesense/templates/instant-search.php on line 22
    [22-Dec-2022 15:44:34 UTC] PHP Warning:  foreach() argument must be of type array|object, null given in /home/xxxxxxx/htdocs/xxxxxxx.com/wp-content/plugins/search-with-typesense/templates/instant-search.php on line 22
    • This topic was modified 1 year, 11 months ago by milans.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor digamberpradhan

    (@digamberpradhan)

    @milans please make sure that your self hosted server is reachable via api requests, also can you please double check your API keys.

    Also can you please go to Typesense > Settings > Advanced and see if you can retrieve the schema fields.

    Thread Starter milans

    (@milans)

    Hi @digamberpradhan, thanks for replying.

    I can retrieve schema fields, and I can do a search query with a shell command as referenced here: https://typesense.org/docs/0.23.1/api/search.html#search-parameters

    I’m using the search API key I’ve generated to do the query.

    • This reply was modified 1 year, 11 months ago by milans.
    Plugin Contributor digamberpradhan

    (@digamberpradhan)

    Hmm – its really difficult to debug a self hosted server as each implementation could have a number of server specific configurations that might prevent it.

    But since you’re able to do query the schema then it looks like query responses are working, additionally.

    Two things i’d try first.
    1. Turn on debug log as well as error log and try a delete and re-index.
    2. If that doesn’t correctly index the Documents then maybe the collection hasn’t been created at all and I would try doing an index of the documents first.

    Lastly – can you double check your shortcode to see if you’re only using the correct fields. The $fields array empty error shows that you’re trying to fetch the details that are not being retrieved,

    Thread Starter milans

    (@milans)

    Sorry for the delay, indexing took a while.

    So I was unable to re-index with the logs enabled, but when I turned logging off, indexing worked. I enabled logging again and the debug log is showing this:

    === START ====
    ::Time:: 2022-12-23::08:21:42-UTC
    (object) array(
       'state' => 1,
       'version' => '0.23.1',
    )
    ===END===
    
    === START ====
    ::Time:: 2022-12-23::08:21:42-UTC
    (object) array(
       'ok' => true,
    )
    ===END===

    I can see the schema fields in the plugin Advanced area, and the timestamp shows it was created yesterday. Also I can still do a search query via shell commands, so the collection is there on the server:

    object	
    {8}
    facet_counts	
    [0]
    found:	1304
    hits
    	[10]
    out_of:	598451
    page:	1
    request_params		
    {3}
    collection_name:	post
    per_page:	10
    q:	test
    search_cutoff:	false
    search_time_ms:	2

    But, still WordPress search is showing no results…

    Plugin Contributor digamberpradhan

    (@digamberpradhan)

    Hi @milans

    Are there any console errors shown on the frontend of the website ?
    It seems that PHP fetching is working correctly but javascript fetching is not.

    As such there should be console errors showing reasons to why the data is not being fetched.

    Additionally, please try using the Typesense cloud option to see if that works for you first.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Not working, no results’ is closed to new replies.