Catalogs and WordPress Search

There has been some questions and comments recently about CataBlog and the WordPress built-in site search capabilities. Currently the catalog items are hidden from the site searches and public queries. This may change in a future version of CataBlog, but for now they are hidden. Unfortunately this has the problem of hiding your catalog content from site searches as WordPress does not automatically expand shortcode content. There are plugins out there that will fix this problem for you. What you need is a plugin, such as Relevanssi - A Better Search, which can expand shortcode content and index it for site searches. I am running Relevanssi on this site. To test it out, simply search for Theo in the column to the right and notice that the demo page shows with title content from CataBlog found as keywords. When using a site index engine such as Relevanssi make sure to change the indexing option to All public post types instead of Everything. You might also want to make sure you have turned off the CataBlog post type in any XML SiteMap generator you have installed. XML - Sitemap should not be including your CataBlog posts in the sitemap by default.

I Hope that was a helpful article. How do you think CataBlog should handle search in the future? Do we still need the ability to have individual catalog item pages? Thanks for you input.

- Zach

This entry was posted in New Features, Support. Bookmark the permalink.

26 Responses to Catalogs and WordPress Search

  1. Joy says:

    From a point of view of a website showing a catalog of items, it’s not nearly as useful without a search.
    I don’t think each item needs its own detail page. I just want to be able to show a list of things in categories and have them easy to create and update. But I’d also like to be able to sort them.

    My target use is for a nursery website where we want to show what’s available, but you don’t buy off the website. It’d be nice to show the plants by season or by color or by water requirements (different ways to categorize them), which I think I can do with the categories. But if you want to find all the flowers that bloom red without much water (combine two categories), you need a search or some way to click on two categories at once. And that’s why a sort is handy, so you can choose one category and sort on the other. Maybe this example is too complex for what Catablog is for, but that’s what I think of for a store catalog. It has lots of products with attributes that you want to be able to compare (sort or search).

    If you just want a photo gallery or a small documentation list, nothing more is needed, especially if the list is pretty short and makes a comfortable sized page. Otherwise, a long list needs pagination and other ways to manipulate it.

    As a side note, it doesn’t matter how the items are stored, so long as you can do what you want with them. The plugin WP-Table-Reloaded puts all the table data into the WordPress options table. Other plugins create their own table. Custom post types are nice, but they don’t do anything for you without a plugin to make them show up on the blog or behave differently than other post types.

    • Zach says:

      That is a great comment, thank you. I agree completely about being able to filter by multiple categories. This very well might make it into a new release soon. But I have no plans of adding a built in search feature for CataBlog anytime soon, and currently their still are no built in ways to browse your catalog in the frontend. This leaves the blog admins in charge of placing their catalogs with specific filters on individual pages. You can then use a plethora of methods to let people browse those specific pages. An example of this would be click clack distro’s blog. Here they have more then a page of items so they simply broke up the catalog into different subsections. I know this does not solve your problem completely, but it does illustrate a way to break up larger catalogs. Also, keep in mind you can always follow this article’s instructions to expand plugin shortcodes for the search indexes.

      As for the side note about where to store things. I believe there are appropriate places to store specific data. WP-Table-Reloaded may store its data in the options, that isn’t a terrible place to store snippets of HTML code in my opinion. Still, all options are loaded by default and you need to be careful because you don’t want a page to load unnecessary data. This is why I store the catalog items themselves in the post data, it is much more flexible and scales better for larger lists. I moved away from using my own table so that I could use the built in database query, which assembles all your data into one query instead of running multiple queries. CataBlog ran multiple queries before revision 0.9.5, which was not good imho. I have taken much time to ensure that CataBlog does not make WordPress any slower. For instance I am working on making the plugin only load its styles and javascript when a pages has catalog data in it. This will help keep page sizes and load time down. 🙂

      I appreciate all the feed back, thanks again.
      – Zach

      • Joy says:

        Zach,
        I hadn’t really looked at the search plugins until you brought it up. I’ll probably be using Relevanssi or Sphider since they add a lot more useful features. Looks like you are finding more things that your plugin doesn’t need to handle.

        You might want to look at a plugin called Custom Post Archives because it handles all the rewrites for archive pages and also the templating for custom post types. Unfortunately, it only lists those post types that are registered as public and publicly queryable (so it can do the rewrites), and Catablog is not registered that way. If it was, the two would play nice together and that would be another big chunk that your plugin doesn’t have to handle. I also like Yoast’s Simple Taxonomies because it has an option to list them at the end of the post (like tags) and a widget that is more customizable than the default tag cloud. Can’t do that with your categories, can we?

  2. Carlos says:

    There is a plugin that is fine with Relevanssi. Is Dave’s Live Search.
    Allows live searches and think it would be a good help for your plugin. You can see it working here http://www.desguacenoroeste.es/

    Regards

  3. Joy says:

    Just thought I’d mention that I found a plugin called Query Multiple Taxonomies that does what I really wanted: search on multiple criteria. You just have to apply the taxonomies to your data so you can search on it…

    • Zach says:

      Joy this is wonderful, and I encourage you to find the right tool out there. If you search google you may also find many tutorials giving example code that does pretty much the same thing. I do like the drill down menus though, very cool feature. The reason I stopped pursuing multiple category filters is because I think it would require custom MySql queries. While it works now, it could very likely break in future versions of WordPress when the database structure changes. I have decided for now to wait until WordPress natively supports multiple category queries on a custom taxonomy in version 3.1.

      – Zach

  4. Jack says:

    Hi Zach,
    This is a very good plugin and thank you for creating it.
    I have a problem with it though. What happens is that I have a Related Posts Thumbnails to show up at the bottom of each post and this is showing in the search list of the catablog items. The result is an ugly looking repetition at the bottom of the post.
    Please look at this page http://diasporic.org/mnimes/archives/homelands-2168
    The same thumbnail is repeated after each catablog item.
    Is this something that you can do by either pointing me in the right direction or does it have to do with Related Posts Thumbnails?

    thank you for your help
    jack

    • Zach says:

      Hi Jack,

      I am unsure exactly how you coded your ‘Related Posts Thumbnail’ at the bottom of each post so it is difficult to troubleshoot. If you did code it yourself perhaps a conditional check that the post type does not contain the string ‘catablog’ or that it is of type ‘post’ or ‘page’ before inserting the thumbnail would fix it. You might also be able to check if the post is public or private, all CataBlog posts are considered private while all standard posts and pages are considered public. If you are using a plugin, I would look through the plugin’s options and see if there is a way to enable it only for public posts. Keep in mind that all CataBlog items are actually posts with a custom type and data set. Good luck and let me know if that information helped.

      – Zach

  5. Jack says:

    Hi Zach,

    I thank you so much for the response.
    I have not coded this myself. Its just a plugin like yours. I have looked at every option for both plugins, yours and the Related Posts one. There’s no option to control public or private post.
    The only way I have been able to remove those post footer Related posts is by removing the category from the post. But this means the actual post goes into limbo land.
    I think the problem is close to what you said in your second last sentence. Catablog items are posts so Related Posts treats them that way and places itself at the bottom. Sounds to me like Related Posts cannot work with Catablog. Is this a fair assumption?
    If this is the case, as described above, then I am really sorry because I loved your Catablog plugin. I must find another way…
    thanks again

    • Zach says:

      Unfortunately I am unable to give you any more advice, I would get in contact with the other plugin developer and see if he/she will fix the bug. The reason I call it a bug is because now with WordPress 3 and Custom Post Types, the plugin needs to be aware of private and public posts and give the admin options to control how the plugin works with them. Good luck and let me know if you want any help contacting the other plugin developer.

      – Zach

  6. Kapil Grover says:

    Hey Zach,

    Thanks for the great plugin. I have a small problem. I installed Relevanssi as you recommended, but still does not search my catalog. Can you help please!?

    Thanks!

    • Zach says:

      Hi Kapil,

      Could you please make sure that the “expand shortcodes” feature is enabled in Relevanssi and that you are using the latest version of Relevanssi, I know there was at least one version that had a bug which stopped it from expanding shortcodes.

  7. lani trock says:

    hello zach!

    thank you again for all of your hard work.

    i have catablog implemented successfully with 10,000+ items here:
    http://www.realmhomefurnishings.org

    i’m now working to implement a search engine and am running into a few speed bumps.
    i’ve tried both relevanssi and search unleashed (both have expand shortcode capabilities)
    everything works okay when searching by key words of the section such as “garden” “wood” or “accent” but what the client has requested is to be able to search by number as well as key words. in the catalog, the item titles are numbers not words. for example “67010”.

    when i search any of the catalog item numbers (item title) i get zero search results.

    do you think that this could be solved by (in the csv) adding each item number i’m want searchable to that item’s description? or add it as an additional category? currently each item has two categories: its section (Wall Decor – Wood) and its page number from the physical version of this catalog (Page 1182).
    I use the page number categorization to organize pagination.

    or is searching by number impossible?

    sorry to ask instead of trying the csv alteration straight away, but since there are so many items and so many csvs (i split them into individuals csv for each sub section at your suggestion to not overwhelm catablog on the csv import) it would take me quite some time to complete.

    thank you again!
    best,
    lani

    • Zach says:

      Can’t help you right away, I’m on vacation. Some things to consider.

      Are the titles (item numbers) being displayed on the page?

      Is Relevanssi Shortcode expansion enabled?

      Does Relevanssi treat numbers like words as far as search term are considered.

      • lani trock says:

        thanks for replying while on vacation! really nice of you.

        answers to your questions:
        1. the titles are displayed over the thumbnail as is with your default grid template.
        2. yes, enabled.
        3. it appears so.

        after a little more tinkering with different queries, i’ve discovered that search unleashed (i’ve been using instead of relevanssi because of a few bonus features. the admin is easier to work with too.) can search numbers. some of the items have numbers in their descriptions and come up in search results when i search those numbers. but for some reason the titles/item numbers are being excluded from the search. considering this, i believe that adding the item number to each item’s description should solve the problem. i may also add to the category for good measure.

        on a separate note, i tried implementing the new create individual pages and archive/category page function, but it crashed about 1000 our of 10,000 in. is there any way to break up this process into sections?

        thank you for your help! i know you are on vacation- i don’t expect a response anytime soon:) hope you have a lovely time too.

        and thank you so much again for catablog. there’s no way i could have made this site without it.

        best,
        lani

  8. lydia says:

    i’ve now got categories set up and doing all the tricks i want, courtesy of the boolean operators described in this thread. yaay!
    http://catablog.illproductions.com/documentation/displaying-your-catalog-in-posts/

    the piece i’m now missing is: does catablog have any way to facilitate searching/filtering for items by price range? from the above it looks like i need to hook up with some kind of search plugin, but are there then hooks into catablog items? i am thinking not so much in terms of a search-result page as of applying a filter to a gallery listing. like, “from this jewelry collection, show me the items that are bracelets. and that contain gemstones. and that cost less than $1000.” …i can see how to approximate the category tasks, by simply creating pages for each of those collections (the earrings page, the silver page, the silver-earrings page), but i’m not seeing any access into the prices.

    can you share any related case studies using Google Custom Search? Relevanssi? Search Unleashed?

    thanks.

    • Zach says:

      I am sorry to say that CataBlog does not have any facilities for filtering catalog item by price. Currently the price is stored in an array of other values, such as the image and sub image names, the link and product code. This stops one from using database queries to filter by a value such as price. Storing the values like that was a short sighted decision by myself that will most likely need to change in the future.

      For now your option would be to load all the catalog items on a specific page (in a category?) and loop through them, programmatically filtering them with PHP. This is not a scalable solution that will work with thousands of catalog items, but it should work if your categories have under a hundred items. I would start by making a form with price options and getting that value working with the url parameters. Then use the CataBlogItem::getItems(); function to load your categories catalog items. Once you have the full array of catalog items loop through them and only render the one’s that are within the price range with the global $wp_plugin_catablog_class; $wp_plugin_catablog_class->frontend_render_catalog_row(); function.

      Wow this is getting kind of convoluted, I hope my explanation makes sense. Really this isn’t the proper solution to your problem, but I don’t have one with CataBlog currently. Perhaps when I implement a customizable catalog item fields option I can re-evaluate how to handle this problem.

      Thanks again for your interest in CataBlog 🙂

      • lydia says:

        oh dear, that’s disappointing news: it sounds like your data structure is going to prevent any search engine from getting in there.

        this whole catalog is only ~550 items, but your PHP idea doesn’t sound like it scales so well — or maybe that’s just because i’m not grokking it entirely. where would this bit of code be living? in functions.php? in a page template? i am afraid that unless you were willing to do more handholding than i have any right to ask, i might have consider this a showstopper. the client didn’t have filter-by-price-range in his original spec when i chose CataBlog as his best fit, and i still think that your app is otherwise a lovely solution… dang!

        thanks for your help.

        • Zach says:

          The limitation of filtering by price is mostly due to the way WordPress engineers designed its database and the data normalization scheme. If I made my own flat table for CataBlog data your request would be trivial, but I decided to integrate CataBlog with WordPress and use their functions for data access instead of making my own.

          This means that each filterable or sortable field must be its own row in the post-meta table. Instead I combined all the custom CataBlog fields into one row, after reading and discussing with other WordPress plugin developers. My way is less flexible, but much simpler.

          I won’t lie, it was a bad decision and now I will have to refactor a fair bit of code and do regression tests before I can fix this. 🙁

          I guess it’s part of the learning curve when working with a new framework. Still, for a free product it’s pretty awesome! 🙂

        • Zach says:

          As you can see it isn’t a trivial process even with normal WordPress posts. WP just wasn’t designed to show posts based on a numerical range of post meta data. I’m going to look into this and it was already on my radar for the customizable catalog data fields feature. Hopefully it will be easier then I anticipate and I can release it sooner than later. In the meantime have you considered using price range categories to categorize your catalog into price ranges. The operator attribute of the Shortcode or PHP function would allow you to only show catalog items that are in two specified categories.

          Thanks again for your interest in CataBlog 🙂

          • lydia says:

            i’ve thought about the price-range-as-category idea. and yes, the boolean shortcode access is awesome! actually with the size of this catalog it seems to me like the original spec of presenting items by category is really more usable than gumming it up with schmancy search/filter features that would be more important in a bigger data set. but once a client decides they want a feature, it’s hard to deliver something else without disappointing them. :/ i will see whether i can create a compelling argument-by-sketch.

            i’m guessing your new explorations wouldn’t magically fit into my timeframe of “client wants this site up in the next few weeks”?

            another desideratum, in case it becomes relevant to the way you’re thinking about this: there was a request for searchability by item number.

  9. Shonari says:

    Is it possible to search products from the catablog admin section. I find after a few hundred products and a couple categories, sifting through the products to make an edit is a long and painstaking process. From the catablog library page, a simple search box would be nice 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Please wrap any HTML markup or code with the pre-formatted tag: <pre> </pre>