- robpl1Participant4 years, 2 months ago #23489
Using Divi Builder for my design work. I wanted to put a search box on the home page so created a file, searcfh.php, in my child template folder and placed the code “echo do_shortcode(‘solr_search_shortcode’); ” between php tags. I then placed [solr_search_shortcode] in a text module on the page. However, what happens then is that immediately below the header bar a search bocx appears after which it appears to be listing all 36,000 records (paginated) before the body of the home page.
I’ve ticked the box “Do not load WPSOLR front-end css. You can then use your own theme css.” so surely that shouldn’t happen? I’ve also created a page for search results and given the name of it to the section “Ajax search page slug”. The index that’s been created is set as the one to be used.
In the data section (2.2) I’ve checked all the ACF fields I want to use but either they’re not being indexed or the index isn’t used. I’ve tested this with a known unique value in one of those fields but all the search boxes I have return “no value”. One of these is a search bar (created by php code in the functions.php file) and another is the Yith Ajax search plugin. I’ve also created a dedicated Search Results template in Divi.
Aslo the Send Data page states ‘A total of 35935 documents are currently in your index “chimes”‘ but WooCommerce thinks I’ve only got 34,627 products. There are no blogs and only 19 pages in total. Would the difference be due to tags, brands and categories perhaps?MTIA
Rob
wpsolrKeymaster4 years, 2 months ago #23490Fortunately, you do not need to do all that.
Just select “Use my own theme search template” in screen 2.1, and your DIVI theme will use its standard search boxes and search page (The WPSOLR Ajax theme is deprecated).
Here is a DIVI demo with WPSOLR and Elasticsearch: https://demo-woocommerce-divi-cloudways.wpsolr.com/shop/
robpl1Participant4 years, 2 months ago #23499Unfortunately that’s not happening for me. I’ve turned all the other stuff off and just tried the Search from Divi search module. I placed something in an ACF field (my surname), indexed it and searched and get not a found message. The fifth line on page 2.1 is labelled “Search template” and I have it set to “Use my current theme search template with Ajax”. I’ve tried it set to ‘without Ajax’ but that makes no difference. I’ve also got a search bar in my header (from Divi’s Menu module) and that too returns Not Found. It seems either the search isn’t using the Solr index or the index isn’t indexing the field. However I think that it is indexing because there are changes that can be seen on the Send Data page when I do something like adding data to a field that needs indexing.
That Demo site is interesting but all it really tells me is that it can be done, and not how. Is there any way of seeing “behind the scenes”?
robpl1Participant4 years, 2 months ago #23515I don’t normally use side bars but I created a page with one on. When the wp-solr widgets are enabled they don’t show, but others do. There’s a standard search widget on there but it only finds things like titles.
Something you said though made me think sideways, so I created a Divi template assigned to Search and a simple text box with [solr_search_shortcode] in it. It now seems to be getting through to the Solr index. Now it would appear to be just a matter of styling the page and the layout of the information that I want on it.
I’d still like to know why the widgets don’t show since that might be important in the searches.
You must be logged in to reply to this topic.