• Resolved mashakos

    (@mashakos)


    I have added post_author to the query_by string in includes\Frontend.php, yet search results do not bring up all posts by an author if I search by their name. Any tips?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor digamberpradhan

    (@digamberpradhan)

    Hi @mashakos

    If you are using the shortcode, then you can always use the query_by shortcode field. Additionally i’ve found that the plugin was indexing the user nicename.

    This will be ammended in the next version of the plugin i.e 1.6.7, a re-index of the posts will be required.

    Thread Starter mashakos

    (@mashakos)

    nicename would be preferred for my needs actually. I tried this
    query_by="nicename,post_title,post_content"
    but it resulted in search not bringing anything up. Any way to get the post author into the query string?

    • This reply was modified 3 years, 7 months ago by mashakos.
    Plugin Contributor digamberpradhan

    (@digamberpradhan)

    Hi @mashakos,

    The latest update 1.6.7 has changed it from user_nicename to dispaly_name,
    to check which fields to use you can always go to Typesense > Advanced Tab to see what the field names.

    For your purposes this would be “post_author”, and i’ve checked that it works for search.

    Plugin Contributor digamberpradhan

    (@digamberpradhan)

    In addition to that you can always change what the data is being sent for your fields, by using the relevant filters.

    In this scenario I would change the post_author field to be exactly what i want, something like the following code.

    add_filter( 'cm_typesense_data_before_entry', 'cm_221109_post_author_modification', 10, 4 );
    function cm_221109_post_author_modification( $formatted_data, $raw_data, $object_id, $schema_name ) {
    	if ( $schema_name == 'post' ) {
    		$formatted_data['post_author'] = get_the_author_meta( 'user_nicename', $raw_data->post_author );
    	}
    
    	return $formatted_data;
    }
    Thread Starter mashakos

    (@mashakos)

    Thank you so much for the assistance! Including the filter hook code is helpful. Results still dont reflect an emphasis on author but I think my hosting is blocking the full index operation, so I will work on that and resolve it on my end.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘post_author not indexed?’ is closed to new replies.