Skip to content

Full-Text Search for Websites Using Algolia

About 593 wordsAbout 2 min

Page ConfigurationUser Guide

2025-03-12

1. Introduction

​ I was using local search for my notes, but there were always some contents that couldn't be found. After searching online, I found the third-party search service, Algolia DocSearch, to implement full-text search for my personal website.

2. Algolia

​ The official VuePress documentation uses Algolia search. The biggest advantage of using Algolia is its convenience: it automatically crawls the website content and builds an index. You only need to apply for an Algolia service, add some code to the website, just like adding analytics code, and then you can have full-text search functionality.

1. Apply for the Algolia DocSearch Service

​ Go to the Algolia DocSearch Apply website, fill in your website address, email, repository address, and other information, and submit the application.

Note: The website address must be public, complete, and stable. If the website is still in the testing phase, the chances of approval are low.

2. Respond to the Confirmation Email

​ Once your application is approved, Algolia DocSearch will send a confirmation email to the email address you provided in the previous step. You will need to reply confirming that you are responsible for the website's development and maintenance and can modify the website's code.

Reply content: Thanks! I am the maintainer of the website, I can modify the code.

​ After that, the next day, you'll receive an email containing the appId, apiKey, and indexName, which are needed to configure the website framework:

3. Activate the Search Service

​ The email from Algolia DocSearch includes the appId, apiKey, and indexName that need to be configured in your website framework. My note template already provides this configuration, and other frameworks are similar:

​ The email also provides a link to accept the invitation. After setting a password (the account is the email you used when applying), you can log in to Algolia.

​ After logging in, select the corresponding project, which should have the same name as the indexName:

​ Click "Go To Crawler" (the blue button in the image above) to enter the crawler backend, which will prompt you to visit the new website:

Click to enter the crawler:

​ If the number in the red box in the image above is 0, proceed to the next step:

​ Click "Editor" on the left menu to view and edit the crawler code. Pay attention to the pathsToMatch path in the code (the white box in the image), which is obviously incorrect. It has an extra docs. Change it to the correct website path https://biji.675222.xyz/**:

The reason is that our website homepage is https://biji.675222.xyz/, and the content we want to search is also here.

​ After making the modification, run a test (as shown in the red box in the image). If data is successfully extracted (as shown in the yellow box in the image), click the "Save" button in the top-right corner to save the code. Then, return to the "Overview" section and click "Restart crawling" in the top-right corner to re-crawl the data.

If you still can't extract data, refer to: https://github.com/mqyqingfeng/Blog/issues/267#issuecomment-1078620438

Done.

What do you think?
  • 0
  • 0
  • 0
  • 0
  • 0
Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v3.4.1

本站支持IPv6访问

公告

親愛なる読者の皆様へ:

いつも私のブログをご覧いただき、温かいご支援をありがとうございます!より良い思考や創作を共有するために、私は日々コンテンツの改善に取り組んでおります。しかし、この過程ではGoogle翻訳やAIなどのツールを使用することがあり、時折表現が完全ではない場合がございます。

日本語版が記事内容を理解するための重要な手段であると感じている読者の方も多いかと思います。そのため、できるだけ早くこれらの内容を補足し、改善するよう努めています。また、特定の記事やテーマを優先的に翻訳してほしい場合は、ぜひコメント欄でお知らせください。皆様のご要望に可能な限りお応えしたいと思っております!

ご理解とご辛抱に心より感謝申し上げます。これからも価値あるコンテンツを創作し、より豊かな読書体験をお届けできるよう努力してまいります。ここで皆様との交流を楽しみにしています!