•  


functions-samples/Node-1st-gen/fulltext-search at main · firebase/functions-samples · GitHub
Skip to content

Latest commit

 

History

History

fulltext-search

Folders and files

Name Name
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Full-text search via Algolia

This template shows how to enable full text search on firebase database elements by using an Algolia hosted search service.

Functions Code

See file functions/index.js for the code.

The dependencies are listed in functions/package.json .

Sample Database Structure

As an example we'll be using a simple blog structure:

/functions-project-12345
    /blog-posts
        /key-123456
            text: "This is my first blog entry..."
            last_index_timestamp: 1234567890
        /key-123457
            text: "This is my second blog entry..."
            last_index_timestamp: 1234567891
    /search
        /queries
            /key-546789
                query: "first entry"
            /key-078234
                query: "second entry"
        /results
            /key-546789
                hits: [...
            /key-078234
                hits: [...
        /last_query_timestamp: 1234567892

Whenever a new blog post is created or modified a Function sends the content to be indexed to the Algolia instance. To perform new searches clients add the search query to the realtime database under /search/queries/ which triggers a Firebase function which performs the search on the Algolia instance. The results are written under the /search/results/ tree.

Setting up the sample

Create an Algolia account at www.algolia.com .

Enable Billing on your Firebase project by switching to the Blaze plan. You need billing enabled to allow external requests. For more information have a look at the pricing page .

Set the algolia.app_id and algolia.api_key Google Cloud environment variables to match the Algolia application ID and API key of your account. For this use:

firebase functions:config:set algolia.app_id=
"
myAlgoliaAppId
"
 algolia.api_key=
"
myAlgoliaApiKey
"
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본