Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TablePress content doesn't show up in search results #39

Closed
JacobDB opened this issue Feb 24, 2016 · 24 comments
Closed

TablePress content doesn't show up in search results #39

JacobDB opened this issue Feb 24, 2016 · 24 comments

Comments

@JacobDB
Copy link

JacobDB commented Feb 24, 2016

I'm working on a site that uses TablePress, and it seems that content inside of a table isn't showing up in search results. For example, on this page there's a table with a cell that says "USCO-003". Searching for that via the search bar at the top of the page does return a few results, but not the actual correct result (which would be the "Overhead Cutouts" page.

I'm guessing this is because it's using a shortcode to display the table. Is there a way to fix this?

@TobiasBg
Copy link
Member

Hi,

thanks for your question, and sorry for the trouble.

I can confirm that the search integration is not working on your site, but unfortunately, I don't see why :-(

You are right with the assumption that content that is rendered by Shortcodes is not searched by default. To work around this, TablePress has its own search integration. This basically works by intercepting the search query, searching through all tables, and then extending the actual search to also search for Shortcodes that contain the search term.

Unfortunately, other plugins or the theme can sometimes disturb this process. Can you therefore please try again after temporarily deactivating all other plugins and after switchting to a WordPress default theme like Twenty Sixteen? That way, we can find what's causing this.

Regards,
Tobias

@JacobDB
Copy link
Author

JacobDB commented Feb 26, 2016

Sure thing, I'll check it out Monday when I'm back in the office. Thanks much :)

@TobiasBg
Copy link
Member

Did these ideas help, @revxx14?

@JacobDB
Copy link
Author

JacobDB commented Mar 23, 2016

Sorry I never followed up on this! I was able to get it working with the following:

add_filter('relevanssi_content_to_index', 'rlv_table_check', 10, 2);
add_filter('relevanssi_excerpt_content', 'rlv_table_check', 10, 2);
function rlv_table_check($content, $post) {
    $additional_content = get_post_meta( $post->ID, 'additional_content', true );

    if ($additional_content) {
        $additional_content_expanded = do_shortcode($additional_content);
        $content .= " " . $additional_content_expanded;
    }

    return $content;
}

Not sure it's the most efficient way to do this (I should probably be filtering with regex for the shortcodes specifically), but it works.

@TobiasBg
Copy link
Member

Hi,

ah, you were using another plugin that also integrates into the search :-) That explains things a bit. Good to hear that you found a solution!

Best wishes,
Tobias

@Robyn-VS
Copy link

Hi,

I'm having the same issue with the search function... JacobDB, did you add that snippet of code to your functions.php file? I'm a designer, not a developer and trying to make sure the website I'm building searches the Tablepress table conten for my client...

Thanks in advance for your help!
Robyn :)

@TobiasBg
Copy link
Member

Hi @Robyn-VS,

are you having these issues on a "standard" site or are you maybe using a special search plugin on your site?

Best wishes,
Tobias

@JacobDB
Copy link
Author

JacobDB commented Sep 26, 2016

@Robyn-VS yea, that went in my functions.php. That particular snippet is for expanding shortcodes within a custom field, and adding the results to the Relevannsi indexing process.

@Robyn-VS
Copy link

Hi @TobiasBg, having these issues on the standard site, I'm not using a special search plugin... I am using it with woo commerce though, I've added tables in the product short descriptions.

And thanks @JacobDB - I'm happy to add the relevannsi plugin, if that will make it work! What kind of custom fields would that snippet check?

@TobiasBg
Copy link
Member

Hi @Robyn-VS,

thanks for the details! This is a different issue then. You will basically have to find out how to make those "product short descriptions" searchable by WordPress. Depending on how they are stored internally, they might not even be searchable to begin with. Then, if they are searchable, you'd have to make them parse Shortcodes so that those are searched.
As this has shown to be tricky for regular posts and pages (for which TablePress offers native support), this will probably not be easy :-/ Checking out third-party search plugins might therefore be a better option.

Regards,
Tobias

@Robyn-VS
Copy link

Hi @TobiasBg,

I thought that might be the case :-/ if I find a solution, I'll let you know! Might try modifying @JacobDB 's snippet to include the product short descriptions... Although hopefully there's an easier solution out there for me! Thanks for your quick responses :)

@zhumakz
Copy link

zhumakz commented Jan 31, 2018

Hey. I have a very large table and therefore a very long query processing. Loads the table on page and it is necessary to wait 5 - 7 seconds. Then everything works. How can I disable the loading of the entire table and only include the search?

@TobiasBg
Copy link
Member

Hi @zhumakz,

I'm afraid that that is not possible at the moment. The search works with JavaScript and this means that all data has to be transferred to the browser before a search can be made :-(

Regards,
Tobias

@NidhinAS
Copy link

Hi,

I am using tablepress for my website. I have colored even row and odd row separately. But when I include the search option and reduce the row limit some table showing the color properly with proper row limit and search options but some table not showing the search option and colors for the row.

@TobiasBg
Copy link
Member

Hi @NidhinAS,

Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

Regards,
Tobias

@NidhinAS
Copy link

Hi... thanks for your reply.... i did not host my site.... i cannot post the link.... some tables showing the search option... I have added even row color and odd row color.... this is not working in tables when I tick the 'Use the following features of the DataTables JavaScript library with this table' option.

@TobiasBg
Copy link
Member

Hi @NidhinAS,

ok, one possible cause for this could be that your table contain #rowspan# or #colspan# to combine/merge cells. This is not compatible with the JavaScript feature. If you are using these, you must remove them from the table, if you want the JavaScript features.

Regards,
Tobias

@NidhinAS
Copy link

Thank you ....yes i have used rowspan and colspan.....one more doubt... i have reduced table width but the search option and pagination appears at the right side of page...is there any way to align with the table width.

@TobiasBg
Copy link
Member

Hi @NidhinAS,

Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

Regards,
Tobias

@NidhinAS
Copy link

Hi.. thank you for your attention... my site is not publicly available right now... I have reduced table width in a page.....but search and pagination appears right side of table... search and pagination not aligned to the table width... if the table width is page size, it seems ok...
Untitled

@TobiasBg
Copy link
Member

Hi @NidhinAS,

ok, can you please add this to the "Custom CSS" textarea on the "Plugin Options" screen of TablePress:

.dataTables_wrapper .tablepress {
  width: 100% !important;
}

Regards,
Tobias

@NidhinAS
Copy link

thank you for your immediate reply.... i have to keep the table always 100% width.....if the table width reduced....search and pagination not compacted to the table width...

@TobiasBg
Copy link
Member

Hi @NidhinAS,

so you actually want a smaller width? And not 100%? Then, you'd have to reduce the width of the container, like

#tablepress-123_wrapper {
   width: 500px; 
}

Regards,
Tobias

@NidhinAS
Copy link

thank you @TobiasBg ....its workiing..... thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants