Why my code does not index all posts correctly?PHP + curl, HTTP POST sample code?Why doesn't this code simply print letters A to Z?Wordpress query from Magento/WHMCS return wrong resultWordpress claiming admin user ID as author for all postsWordPress custom post type pagination links return 404Getting ID from get_posts within a loop in WordpressAlgolia WordPress Plugin Wont Process Index Cueuecustom post_type - changing the posts_per_page - not working correctlyGet image post by taxonomy/category wordpressWordpress Algolia plugin, only indexes all posts into searchable_posts index, rather than enabled ones?
It is as easy as A B C, Figure out U V C from the given relationship
Is there any deeper thematic meaning to the white horse that Arya finds in The Bells (S08E05)?
Could a space colony 1g from the sun work?
Understanding Deutch's Algorithm
UUID type for NEWID()
How to describe a building set which is like LEGO without using the "LEGO" word?
Would life always name the light from their sun "white"
What is the status of the Lannisters after Season 8 Episode 5, "The Bells"?
To whom did Varys write those letters in Game of Thrones S8E5?
Is the seat-belt sign activation when a pilot goes to the lavatory standard procedure?
Is there any good reason to write "it is easy to see"?
How to rename multiple files in a directory at the same time
Formal Definition of Dot Product
When did game consoles begin including FPUs?
With today's technology, could iron be smelted at La Rinconada?
Does this "yield your space to an ally" rule my 3.5 group uses appear anywhere in the official rules?
Promotion comes with unexpected 24/7/365 on-call
Can my American children re-enter the USA by International flight with a passport card? Being that their passport book has expired
What is the effect of the Feeblemind spell on Ability Score Improvements?
Why would company (decision makers) wait for someone to retire, rather than lay them off, when their role is no longer needed?
What was Varys trying to do at the beginning of S08E05?
Why did the soldiers of the North disobey Jon?
Why is the Advance Variation considered strong vs the Caro-Kann but not vs the Scandinavian?
Assembly writer vs compiler
Why my code does not index all posts correctly?
PHP + curl, HTTP POST sample code?Why doesn't this code simply print letters A to Z?Wordpress query from Magento/WHMCS return wrong resultWordpress claiming admin user ID as author for all postsWordPress custom post type pagination links return 404Getting ID from get_posts within a loop in WordpressAlgolia WordPress Plugin Wont Process Index Cueuecustom post_type - changing the posts_per_page - not working correctlyGet image post by taxonomy/category wordpressWordpress Algolia plugin, only indexes all posts into searchable_posts index, rather than enabled ones?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have more than 600,000 posts to be indexed by Algolia (Wordpress based), so I wrote a "reindex_post" command to enable all my posts indexed batch by batch to avoid memory used up. However, when I use this command in WP-CLI, some posts seem not to be indexed correctly and I found two errors:
Some posts can't be searched from my front end though I can see it at the back end of Algolia.
When I enter more than 3 characters in my front end, autocomplete does not work though it works when I enter less than 3 characters.
I installed the Algolia wordpress plugin and tried using it index my posts and found that it works well. None of the two problems below happened. The only problem is I can't index 600,000 posts by this way.
public function reindex_post($args, $assoc_args)
$start = 0;
$end = 0;
if (count($args) === 1)
$arr = explode(',', $args[0]);
$start = intval($arr[0]);
$end = intval($arr[1]);
echo "鍚姩鍒嗛〉锛?start->$endn";
global $algolia;
$index = $algolia->initIndex('wp_searchable_posts');
$paged = $start;
$count = 0;
do
$posts = new WP_Query([
'posts_per_page' => 50,
'paged' => $paged,
'post_type' => 'post'
]);
if (!$posts->have_posts())
break;
$records = [];
foreach ($posts->posts as $post)
if ($assoc_args['verbose'])
WP_CLI::line('Serializing [' . $post->post_title . ']');
$record = (array)apply_filters('post_to_record', $post);
if (!isset($record['objectID']))
$record['objectID'] = implode('#', [$post->post_type, $post->ID]);
$records[] = $record;
$count++;
if ($assoc_args['verbose'])
WP_CLI::line('Sending batch');
$index->saveObjects($records);
$paged++;
if ($paged > $end)
break;
while (true);
WP_CLI::success("$count posts indexed in Algolia");
}
I'm a new programmer and not very familiar with php. I would highly appreciate it if some one can tell me how to modify it exactly
php wordpress algolia
add a comment |
I have more than 600,000 posts to be indexed by Algolia (Wordpress based), so I wrote a "reindex_post" command to enable all my posts indexed batch by batch to avoid memory used up. However, when I use this command in WP-CLI, some posts seem not to be indexed correctly and I found two errors:
Some posts can't be searched from my front end though I can see it at the back end of Algolia.
When I enter more than 3 characters in my front end, autocomplete does not work though it works when I enter less than 3 characters.
I installed the Algolia wordpress plugin and tried using it index my posts and found that it works well. None of the two problems below happened. The only problem is I can't index 600,000 posts by this way.
public function reindex_post($args, $assoc_args)
$start = 0;
$end = 0;
if (count($args) === 1)
$arr = explode(',', $args[0]);
$start = intval($arr[0]);
$end = intval($arr[1]);
echo "鍚姩鍒嗛〉锛?start->$endn";
global $algolia;
$index = $algolia->initIndex('wp_searchable_posts');
$paged = $start;
$count = 0;
do
$posts = new WP_Query([
'posts_per_page' => 50,
'paged' => $paged,
'post_type' => 'post'
]);
if (!$posts->have_posts())
break;
$records = [];
foreach ($posts->posts as $post)
if ($assoc_args['verbose'])
WP_CLI::line('Serializing [' . $post->post_title . ']');
$record = (array)apply_filters('post_to_record', $post);
if (!isset($record['objectID']))
$record['objectID'] = implode('#', [$post->post_type, $post->ID]);
$records[] = $record;
$count++;
if ($assoc_args['verbose'])
WP_CLI::line('Sending batch');
$index->saveObjects($records);
$paged++;
if ($paged > $end)
break;
while (true);
WP_CLI::success("$count posts indexed in Algolia");
}
I'm a new programmer and not very familiar with php. I would highly appreciate it if some one can tell me how to modify it exactly
php wordpress algolia
add a comment |
I have more than 600,000 posts to be indexed by Algolia (Wordpress based), so I wrote a "reindex_post" command to enable all my posts indexed batch by batch to avoid memory used up. However, when I use this command in WP-CLI, some posts seem not to be indexed correctly and I found two errors:
Some posts can't be searched from my front end though I can see it at the back end of Algolia.
When I enter more than 3 characters in my front end, autocomplete does not work though it works when I enter less than 3 characters.
I installed the Algolia wordpress plugin and tried using it index my posts and found that it works well. None of the two problems below happened. The only problem is I can't index 600,000 posts by this way.
public function reindex_post($args, $assoc_args)
$start = 0;
$end = 0;
if (count($args) === 1)
$arr = explode(',', $args[0]);
$start = intval($arr[0]);
$end = intval($arr[1]);
echo "鍚姩鍒嗛〉锛?start->$endn";
global $algolia;
$index = $algolia->initIndex('wp_searchable_posts');
$paged = $start;
$count = 0;
do
$posts = new WP_Query([
'posts_per_page' => 50,
'paged' => $paged,
'post_type' => 'post'
]);
if (!$posts->have_posts())
break;
$records = [];
foreach ($posts->posts as $post)
if ($assoc_args['verbose'])
WP_CLI::line('Serializing [' . $post->post_title . ']');
$record = (array)apply_filters('post_to_record', $post);
if (!isset($record['objectID']))
$record['objectID'] = implode('#', [$post->post_type, $post->ID]);
$records[] = $record;
$count++;
if ($assoc_args['verbose'])
WP_CLI::line('Sending batch');
$index->saveObjects($records);
$paged++;
if ($paged > $end)
break;
while (true);
WP_CLI::success("$count posts indexed in Algolia");
}
I'm a new programmer and not very familiar with php. I would highly appreciate it if some one can tell me how to modify it exactly
php wordpress algolia
I have more than 600,000 posts to be indexed by Algolia (Wordpress based), so I wrote a "reindex_post" command to enable all my posts indexed batch by batch to avoid memory used up. However, when I use this command in WP-CLI, some posts seem not to be indexed correctly and I found two errors:
Some posts can't be searched from my front end though I can see it at the back end of Algolia.
When I enter more than 3 characters in my front end, autocomplete does not work though it works when I enter less than 3 characters.
I installed the Algolia wordpress plugin and tried using it index my posts and found that it works well. None of the two problems below happened. The only problem is I can't index 600,000 posts by this way.
public function reindex_post($args, $assoc_args)
$start = 0;
$end = 0;
if (count($args) === 1)
$arr = explode(',', $args[0]);
$start = intval($arr[0]);
$end = intval($arr[1]);
echo "鍚姩鍒嗛〉锛?start->$endn";
global $algolia;
$index = $algolia->initIndex('wp_searchable_posts');
$paged = $start;
$count = 0;
do
$posts = new WP_Query([
'posts_per_page' => 50,
'paged' => $paged,
'post_type' => 'post'
]);
if (!$posts->have_posts())
break;
$records = [];
foreach ($posts->posts as $post)
if ($assoc_args['verbose'])
WP_CLI::line('Serializing [' . $post->post_title . ']');
$record = (array)apply_filters('post_to_record', $post);
if (!isset($record['objectID']))
$record['objectID'] = implode('#', [$post->post_type, $post->ID]);
$records[] = $record;
$count++;
if ($assoc_args['verbose'])
WP_CLI::line('Sending batch');
$index->saveObjects($records);
$paged++;
if ($paged > $end)
break;
while (true);
WP_CLI::success("$count posts indexed in Algolia");
}
I'm a new programmer and not very familiar with php. I would highly appreciate it if some one can tell me how to modify it exactly
php wordpress algolia
php wordpress algolia
edited Mar 23 at 16:58
Progman
6,77232037
6,77232037
asked Mar 23 at 15:19
GreatZhaoGreatZhao
11
11
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315245%2fwhy-my-code-does-not-index-all-posts-correctly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55315245%2fwhy-my-code-does-not-index-all-posts-correctly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown