txcapstudio
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Search with Algolia] Custom Post Meta Not Showing in SearchHey Michael,
Just figured it out. I was under the impression that the dev_searchable_posts updates automatically when re-indexing any other index. That’s my lack of understanding on Algolia. Thanks for letting me wrestle through this! Looks like it is working now.
Forum: Plugins
In reply to: [WP Search with Algolia] Custom Post Meta Not Showing in SearchI see what you mean. The two fields I’m trying to test with are not in the response JSON body. What could cause them to be indexed in Algolia, but not come through on the response?
In the response… Anything with the post type
listingshould have the custom fields. The other post types should not.Forum: Plugins
In reply to: [WP Search with Algolia] Custom Post Meta Not Showing in SearchHey Michael,
I think I figured it out. The index that does have the custom fields is…
“dev_posts_listing”
However, the index being shown in the results that I just realized from the XHR request in the developer console is…
“dev_searchable_posts”
I was assuming if the field was indexed in the specific post type index that it would also be in the searchable_posts index. How do we get the custom fields to show up in the searchable_posts index? Do we HAVE to make those custom fields searchable and then just reindex??
Thanks again!
Forum: Plugins
In reply to: [WP Search with Algolia] Custom Post Meta Not Showing in SearchHey Michael!
Thank you.. I did try triple brackets. No luck there!
As for the top-level property on the object. Are you referring to if the custom field is a top level property on the post type? I’m not actually sure about that. The custom fields are created with CMB2, I believe!
In the index, the two fields we’re trying to output appear in Algolia like this.. No arrays and not within a separate object.
listing_hay_price : "75" listing_city : "Sabula"For making the fields indexable, we used your super helpful post featuring the filters
algolia_post_shared_attributes algolia_searchable_post_shared_attributesThen in the instantsearch.php file we have the following inside the ais-hits–content…
<h2 itemprop="name headline"> <a href="{{ data.permalink }}" title="{{ data.post_title }}" class="ais-hits--title-link" itemprop="url">data._highlightResult.post_title.value</a> </h2> <div class="excerpt"> <p> <# if ( data._snippetResult['content'] ) { #> <span class="suggestion-post-content ais-hits--content-snippet">data._snippetResult['content'].value</span> <# } #> </p> <p>City = {{ data.listing_city }}</p> </div>Thanks for the help!