Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › index pdf contents of custom post type
This topic contains 9 replies, has 2 voices, and was last updated by gendalone 3 years, 11 months ago.
- AuthorPosts
- June 10, 2019 at 11:54 am #23079
Hello,
I would like to know if there’s a way to index pdf content not loaded like media files but loaded under custom post type
(eg. download manager plugin loads its own pdf documents into custom post – not page nor article – and attachments are stored outside media library)Your plugin is able to index custom posts title – text content – excerpt – category and tags but I’m not able to include its attachments into index search.
Thank you in advance for support.
June 10, 2019 at 12:58 pm #23085Hi,
I’m afraid that is not possible. I will note this as a possible feature request, I think it should be possible to implement this with only minor modifications on the source code + adding an option for it.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 10, 2019 at 1:13 pm #23089Thanks for reply,
if source code modification is not too complex, and not too loss-time for you,
I could try to do it on my installation.June 11, 2019 at 8:41 am #23096You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 25, 2019 at 12:31 pm #23388Hi Ernest,
excuse me for disturb,
I understand what kind of work there’s behind coding and I can image you don’t have time to implement my particular feature;
in the meantime, where could I look for into source code to extend pdf index to files not included in media library (eg. file uploaded under download manager)?Thank you for your time.
June 25, 2019 at 2:18 pm #23397Hi,
This might be much more complicated than I thought. May I ask which plugin do you use exactly for these attachments? I will have to look into their API, as there is no universal solution to get any attachments related to a certain post, unless it is within the media library. Even worse, if the items are not custom post types.
Indexing Media attachments along with their parent posts could be doable, but when a file is outside the Media library, it becomes a nightmare.Well, the indexing process is a bit complicated, there are multiple files involved. The main file that controls the indexing is wp-content/plugins/ajax-search-pro/includes/classes/etc/indextable.class.php
Best,
However I honestly does not recommend modifying that, it could be extremely time consuming.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 25, 2019 at 2:44 pm #23398Hi Ernest,
thank you for quick reply;I’m using wp-download-manager (pro version);
You are right, packages are stored as custom posts (in _posts table), but theis attachments (multiple files in pro version) are stored in _postmeta table, refer to their post_id, with custom meta_keys (__wpdm_files) and with custom meta_value (eg. a:3:{i:1562334567887;s:30:”FILE1.pdf”;i:1563456789376;s:30:”FILE2.pdf”;i:156345353344;s:30:”FILE3.pdf”;}
Here we don’t know custom relative path becouse it is a value stored in _options.
I think that is a very complex case….
June 27, 2019 at 7:47 pm #23471Hi again,
I could have found a workaround but there is a problem with relative link:
I upload pdf files in standard wp media library and index search works fine (in search bar I can find my results)
but results can link to: attachment file, attachment page or attachment parent post.I’ve tried to use another plugin to customize media link, but in this case too, the link is stored in _postmeta table.
If there is a way to use a custom link (and custom image too) should be a valid workaround
(I know that pdf files should be uploaded twice but I don’t see any other solution)Thank you
June 28, 2019 at 7:49 am #23475Hi,
Thank you for the previous details, I will look into that plugin API, I already added it to the upcoming features list. It is a pretty decent plugin, I am sure they have an API I can use to get the downloads.
For changing the result URLs as well as image, a custom code should be used. There is this example, based on that, you could try something like this:
Best,add_filter( 'asp_results', 'asp_custom_link_results', 1, 1 ); function asp_custom_link_results( $results ) { // Parse through each result item foreach ($results as $k=>&$r) { if ( isset($r->post_type) && $r->post_type == 'attachment' ) { // $r->id is the attachment ID, in case needed $r->link = 'https://google.com'; // custom link $r->image = https://'myimage.com/image.jpeg'; // custom image url } } return $results; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 28, 2019 at 10:52 am #23496Thank you very much for reply.
I’ll try to customize your sample function to get custom link and custom image
getting info by $r->id post id into _postmeta table.Hope you will be able to implement attachment index feature with wp-download-manager plugin,
1st becouse that plugin is most used download plugin and 2nd they don’t have plan to develope attachment index feature, so you can be linked by them to use your plugin for search. - AuthorPosts
You must be logged in to reply to this topic.