只要您的网站发生变化,您就可以运行脚本或项目,请求搜索自动机使用远程控制运行索引。
远程控制索引请求通常来自位于您服务器上的脚本或项目。
自动机执行的索引步骤与从Index菜单手动启动的步骤相同。 要提交远程控制请求,请配置必要的口令和响应字符串。
要发出远程控制请求,请根据数据中心的位置使用以下格式示例:
数据中心位置 |
示例 |
---|---|
伦敦 |
|
北美洲 |
|
新加坡 |
|
或
字符串和值 |
描述 |
---|---|
sp_a= sp99999999 |
您的帐号。 您可以在 设置 > 帐户选项 > 帐户设置 下找到您的帐号。 |
sp_lines= N |
用于检查正在运行的索引爬网的状态。 N 是正整数或全 部 。如果这是数值,则相应的索引日志文件的最后一行 N 将包含在JSON响应中。 如果该值为所有,则返回整个文件。 如果值为 0 ,则不返回日志信息。 此值是正在运行的索引状态查询的默认值。 |
sp_operation= op |
允许您指定要运行的以下索引编制操作之一:
注意: 要使用垂直更新,您可能需要在您的帐户中由Adobe帐户代表或Adobe支持启用它。 请参阅关于垂直更新。 可以将_saved 追加到以上任何 sp_operation 值,让搜索自动机尝试使用已保存的内容。 例如,您可以指定以下内容: 或 或者,可以将 _status 追加到以上任何 sp_operation 值,以请求当前或最新操作的状态报告。 例如,您可以指定以下内容: 或 结果将作为JSON对象返回。 包括 sp_lines=N 以包括关联日志文件的N行。 如果N为负,则包括最后的N行。 |
sp_operation= pushlive |
允许您远程推送分阶段索引。 忽略将_saved 追加到推送实时操作的任何尝试。 运行 pushlive 操作时,OK、Priority或Error响应文本字符串将返回给服务器。 在远程控制页面上指定这些响应字符串。 请参阅配置远程控制以进行索引。 如果在没有分阶段索引时实时推送,则不会发生任何情况,并返回“确定”响应字符串。 |
sp_password= xxxxx |
遥控密码。 |
搜索以正确的HTTP响应形式返回数据。 完整响应由HTTP状态、HTTP响应头、空行和响应字符串组成。
例如,假定您执行以下远程控制请求:
https://center.atomz.com/search/cgiindex.tk?sp_a=sp99999999&sp_password=my-password&sp_operation=full_index
以下是来自服务器的响应:
Status: 200 OK
Content-type: text/plain
OK
或者,假定您执行以下远程控制状态请求:
https://center.atomz.com/search/cgiindex.tk?sp_a=sp99999999&sp_password=my-password&sp_operation=full_index_status
来自服务器的响应可能如下所示:
Status: 200 OK
Content-type: application/json; charset=utf-8
{
"current_time": "2017-08-27T10:58:58-0700",
"start_time": "2017-07-25T16:40:07-0800",
"end_time": "2017-07-25T16:40:20-0800",
"elapsed_seconds": 13,
"elapsed_seconds_fmt": "13s",
"state": "finished",
"docs_indexed": 3,
"depth": 0,
"errors": 0,
"status": 1,
"message": "ok"
}
要获取与此索引操作关联的日志列表的前十行及其状态,使用以下查询:
https://center.atomz.com/search/cgiindex.tk?sp_a=sp99999999&sp_password=my-password&sp_operation=full_index_status&sp_lines=10
来自服务器的响应:
Status: 200 OK
Content-type: application/json; charset=utf-8
{
"current_time": "2017-08-27T10:59:30-0700",
"start_time": "2017-07-25T16:40:07-0800",
"end_time": "2017-07-25T16:40:20-0800",
"elapsed_seconds": 13,
"elapsed_seconds_fmt": "13s",
"state": "finished",
"docs_indexed": 3,
"depth": 0,
"errors": 0,
"offset": 672,
"lines": [
"07/25 16:40:07 PST ======== Starting manual crawl of account sp99999999. ========",
"07/25 16:40:08 PST Loading existing data",
"07/25 16:40:08 PST Downloading entrypoint https://www.atomz.com/",
"07/25 16:40:08 PST Robots.txt exclude mask: https://www.atomz.com/snap",
"07/25 16:40:08 PST Exclude mask: regexp ^https://www.atomz.com/$",
"07/25 16:40:08 PST Include mask: https://www.atomz.com/",
"07/25 16:40:08 PST Downloading https://www.atomz.com/style.css",
"07/25 16:40:09 PST Ignoring https://www.atomz.com/style.css, document type 'text/css'.",
"07/25 16:40:09 PST Downloading https://www.atomz.com/privacy.html",
"07/25 16:40:09 PST Downloading https://www.atomz.com/terms.html"
],
"status": 1,
"message": "ok"
}
请注意offset
值。 此值标识日志文件中读取中断的文件偏移位置。 要读取文件中的下一行十行,您应在发送到服务器的请求中加入&sp_offset=672
。
使用sp_offset
,您可以有效地翻阅日志文件。
要获取日志的last十行以及状态,请将计数指定为负数。 例如,指定sp_lines=
的值为-10
,如下所示:
https://center.atomz.com/search/cgiindex.tk?sp_a=sp99999999&sp_password=my-password&sp_operation=full_index_status&sp_lines=-10
来自服务器的响应:
Status: 200 OK
Content-type: application/json; charset=utf-8
{
"current_time": "2017-08-27T11:01:14-0700",
"start_time": "2017-07-25T16:40:07-0800",
"end_time": "2017-07-25T16:40:20-0800",
"elapsed_seconds": 13,
"elapsed_seconds_fmt": "13s",
"state": "finished",
"docs_indexed": 3,
"depth": 0,
"errors": 0,
"lines": [
"07/25 16:40:20 PST End Time: 07/25/2017 16:40:20 PST",
"07/25 16:40:20 PST Elapsed Time: 13 seconds",
"07/25 16:40:20 PST Pages Crawled: 3 pages",
"07/25 16:40:20 PST Pages Indexed: 3 pages",
"07/25 16:40:20 PST Words/Bytes Indexed: 2373 words/ 20618 bytes",
"07/25 16:40:20 PST Errors: 0",
"07/25 16:40:20 PST *** Index Summary ***",
"07/25 16:40:20 PST Total Pages: 3",
"07/25 16:40:20 PST --------------------------------------------------------------------",
"07/25 16:40:20 PST ======== Finish manual crawl of account sp99999999: Done. ========"
],
"status": 1,
"message": "ok"
}
请注意,此处没有返回任何offset
值,因为此操作在文件末尾完成,并且没有其他要读取的行。
只要您的网站发生变化,您就可以使用远程控制从服务器运行脚本或项目,请求搜索自动机运行索引。
为索引配置远程控制
在产品菜单中,单击Index > Remote Control。
在Remote Control页面上,设置每个配置字段选项,以便能够自动从服务器提交索引请求以索引您的网站。
选项 |
描述 |
---|---|
远程控制密码 |
指定远程控制密码。 密码区分大小写,至少长6个字符,并且必须至少包含一个字母。 建议您还至少包含一个数字。 请勿使用网站搜索/销售登录密码。 您的密码将用于每个远程控制请求。 |
确定响应字符串 |
允许您指定OK响应文本字符串(如果请求的索引操作成功开始)。 在这种情况下,搜索自动机会将您的OK响应字符串返回给服务器。 |
优先级响应字符串 |
如果在发出远程请求时正在进行另一个索引操作,则搜索机器人无法执行所请求的索引。 在这种情况下,您的优先级响应文本字符串将返回到服务器。 |
错误响应字符串 |
允许您指定错误响应文本字符串如果密码不正确,或者出现其他错误。 在这种情况下,搜索自动机会将您的错误响应字符串返回给服务器。 |
单击 Save Changes.