Constructing An Open Supply Decentralized E-Ebook Search Engine
{“payload”:{“allShortcutsEnabled”:false,”fileTree”:{“”:{“objects”:[{“name”:”img”,”path”:”img”,”contentType”:”directory”},{“name”:”public”,”path”:”public”,”contentType”:”directory”},{“name”:”src”,”path”:”src”,”contentType”:”directory”},{“name”:”README.md”,”path”:”README.md”,”contentType”:”file”},{“name”:”index.html”,”path”:”index.html”,”contentType”:”file”},{“name”:”package-lock.json”,”path”:”package-lock.json”,”contentType”:”file”},{“name”:”package.json”,”path”:”package.json”,”contentType”:”file”},{“name”:”tsconfig.json”,”path”:”tsconfig.json”,”contentType”:”file”},{“name”:”tsconfig.node.json”,”path”:”tsconfig.node.json”,”contentType”:”file”},{“name”:”tutorial.md”,”path”:”tutorial.md”,”contentType”:”file”},{“name”:”vite.config.ts”,”path”:”vite.config.ts”,”contentType”:”file”}],”totalCount”:11}},”fileTreeProcessingTime”:1.8577540000000001,”foldersToFetch”:[],”repo”:{“id”:770186082,”defaultBranch”:”predominant”,”identify”:”ebook-demo”,”ownerLogin”:”j2qk3b”,”currentUserCanPush”:false,”isFork”:false,”isEmpty”:false,”createdAt”:”2024-03-11T05:06:26.000Z”,”ownerAvatar”:”https://avatars.githubusercontent.com/u/162471940?v=4″,”public”:true,”non-public”:false,”isOrgOwned”:false},”symbolsExpanded”:false,”treeExpanded”:true,”refInfo”:{“identify”:”predominant”,”listCacheKey”:”v0:1710133766.0″,”canEdit”:false,”refType”:”department”,”currentOid”:”325fad959ea86c615b446ccdff8209df41e6e7e6″},”path”:”tutorial.md”,”currentUser”:null,”blob”:{“rawLines”:null,”stylingDirectives”:null,”csv”:null,”csvError”:null,”dependabotInfo”:{“showConfigurationBanner”:false,”configFilePath”:null,”networkDependabotPath”:”/j2qk3b/ebook-demo/community/updates”,”dismissConfigurationNoticePath”:”/settings/dismiss-notice/dependabot_configuration_notice”,”configurationNoticeDismissed”:null},”displayName”:”tutorial.md”,”displayUrl”:”https://github.com/j2qk3b/ebook-demo/blob/predominant/tutorial.md?uncooked=true”,”headerInfo”:{“blobSize”:”4.66 KB”,”deleteTooltip”:”You have to be signed in to make or suggest modifications”,”editTooltip”:”You have to be signed in to make or suggest modifications”,”ghDesktopPath”:”https://desktop.github.com”,”isGitLfs”:false,”onBranch”:true,”shortPath”:”372cc0c”,”siteNavLoginPath”:”/login?return_to=httpspercent3Apercent2Fpercent2Fgithub.compercent2Fj2qk3bpercent2Febook-demopercent2Fblobpercent2Fmainpercent2Ftutorial.md”,”isCSV”:false,”isRichtext”:true,”toc”:[{“level”:1,”text”:”Building An Open Source Decentralized E-Book Search Engine”,”anchor”:”building-an-open-source-decentralized-e-book-search-engine”,”htmlText”:”Building An Open Source Decentralized E-Book Search Engine”},{“level”:3,”text”:”Step 1 – Initialize the Project”,”anchor”:”step-1—initialize-the-project”,”htmlText”:”Step 1 – Initialize the Project”},{“level”:4,”text”:”JavaScript”,”anchor”:”javascript”,”htmlText”:”JavaScript”},{“level”:3,”text”:”Python”,”anchor”:”python”,”htmlText”:”Python”},{“level”:3,”text”:”Step 2 – Connect to the Network”,”anchor”:”step-2—connect-to-the-network”,”htmlText”:”Step 2 – Connect to the Network”},{“level”:4,”text”:”JavaScript”,”anchor”:”javascript-1″,”htmlText”:”JavaScript”},{“level”:3,”text”:”Python”,”anchor”:”python-1″,”htmlText”:”Python”},{“level”:3,”text”:”Step 3 – Build Search Function”,”anchor”:”step-3—build-search-function”,”htmlText”:”Step 3 – Build Search Function”},{“level”:4,”text”:”JavaScript”,”anchor”:”javascript-2″,”htmlText”:”JavaScript”},{“level”:3,”text”:”Python”,”anchor”:”python-2″,”htmlText”:”Python”},{“level”:3,”text”:”Step 4 – Display Search Results”,”anchor”:”step-4—display-search-results”,”htmlText”:”Step 4 – Display Search Results”}],”lineInfo”:{“truncatedLoc”:”121″,”truncatedSloc”:”85″},”mode”:”file”},”picture”:false,”isCodeownersFile”:null,”isPlain”:false,”isValidLegacyIssueTemplate”:false,”issueTemplate”:null,”discussionTemplate”:null,”language”:”Markdown”,”languageID”:222,”giant”:false,”planSupportInfo”:{“repoIsFork”:null,”repoOwnedByCurrentUser”:null,”requestFullPath”:”/j2qk3b/ebook-demo/blob/predominant/tutorial.md”,”showFreeOrgGatedFeatureMessage”:null,”showPlanSupportBanner”:null,”upgradeDataAttributes”:null,”upgradePath”:null},”publishBannersInfo”:{“dismissActionNoticePath”:”/settings/dismiss-notice/publish_action_from_dockerfile”,”releasePath”:”/j2qk3b/ebook-demo/releases/new?market=true”,”showPublishActionBanner”:false},”rawBlobUrl”:”https://github.com/j2qk3b/ebook-demo/uncooked/predominant/tutorial.md”,”renderImageOrRaw”:false,”richText”:”
Just lately, I used to be really helpful an fascinating web site referred to as Liber3 by a pal, which makes use of ENS domains. They’ve created an e-book search web site operating on ENS and IPFS. Then, I performed some evaluation on their community requests and located that they seem like utilizing Glitter, a decentralized database service constructed with Tendermint.
n
Sadly, as a result of Liber3 has not made their supply code obtainable, after reviewing Glitter’s documentation and open datasets saved on it, I made a decision to implement an open-source group model myself. This fashion, everybody can create their very own e-book search web site.
n
n
First, create a brand new challenge and set up Glitter SDK. This SDK permits you to simply connect with the Glitter community and acquire metadata of e-books.
nnn
npm set up @glitterprotocol/glitter-sdk
nnnn
n
Subsequent, producing a shopper in order that the appliance can work together with Glitter community. We initialize an LCDClient occasion via Glitter SDK and configure the related parameters
nnn
import { LCDClient, MnemonicKey, Cash, Numeric } from '@glitterprotocol/glitter-sdk';nnconst XIAN_HOST = "https://api.xian.glitter.hyperlink"nconst CHAIN_ID = "glitter_12000-2"nconst mk = new MnemonicKey({n mnemonic: "lesson police ordinary earth embrace somebody opera season city produce jealous canyon shrug utilization topic cigar imitate hole route inhale vocal particular solar gas"n});nnconst shopper = new LCDClient({n URL: XIAN_HOST,n chainID: CHAIN_ID,n gasPrices: Cash.fromString('0.15agli'),n gasAdjustment: Numeric.parse(1.5),n})nconst dbClient = shopper.db(key);
nn
from glitter_sdk.shopper.liquid crystal display import LCDClientnfrom glitter_sdk.core import Numeric, Cashnfrom glitter_sdk.key.mnemonic import MnemonicKeynnXIAN_HOST = "https://api.xian.glitter.hyperlink"nCHAIN_ID = "glitter_12000-2"nmk = MnemonicKey(n "lesson police ordinary earth embrace somebody opera season city produce jealous canyon shrug utilization topic cigar imitate hole route inhale vocal particular solar gas"n)nnshopper = LCDClient(n chain_id=CHAIN_ID,n url=XIAN_HOST,n gas_prices=Cash.from_str("0.15agli"),n gas_adjustment=Numeric.parse(1.5))ndbClient = shopper.db(mk)
nn
n
The search operate is the core of the appliance. We outline a search operate that accepts the consumer’s question key phrases, constructs a question assertion, and sends it to the Glitter community.
nnn
import { MatchPhraseQuery, queryStringPrepare, prepareSQL } from '@glitterprotocol/glitter-sdk';nnconst queries = [];nconst question = 'Come Prima'nqueries.push(new MatchPhraseQuery('title', `${question}`));nconst queryStr = queryStringPrepare(queries);nnconst sql = `SELECT ipfs_cid, title, writer, extension, language, writer, 12 months, filesize, _score, _id FROM library.e-book WHERE query_string(?) LIMIT 0, 200`;nconst newSql = prepareSQL(sql, queryStr);nconst sqlData = await dbClient.question(newSql);
nn
from glitter_sdk.util.parse_query_str import *nfrom glitter_sdk.util.parse_query_str import *nfrom glitter_sdk.util. parse_sql import *nnqueries = []nquestion = "Come Prima"nqueries.append(MatchPhraseQuery("title", question))nquery_str = query_string_prepare(queries)nsql = "SELECT ipfs_cid, title, writer, extension, language, writer, 12 months, filesize, _score, _id FROM library.e-book WHERE query_string(%s)"nsql = prepare_sql(sql, [query_str])nrst = db.question(sql)
nn
n
After constructing search operate, we have to show search outcomes on front-end interface. This contains designing a interface to point out the essential data of e-books and offering some interactive components in order that customers can simply browse and choose the books they’re interested by.
n
n
With these 4 steps, we are able to construct a e-book search engine, offering customers with an environment friendly and handy platform for retrieving e-book assets. You might publish a compiled model of this web site to IPFS community, then you might be having a decentralized e-book search engine hosted on IPFS accessible through any IPFS gateway.
n
Your entire supply code is offered here on this repo.
n
“,”renderedFileInfo”:null,”shortPath”:null,”symbolsEnabled”:true,”tabSize”:8,”topBannersInfo”:{“overridingGlobalFundingFile”:false,”globalPreferredFundingPath”:null,”showInvalidCitationWarning”:false,”citationHelpUrl”:”https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files”,”actionsOnboardingTip”:null},”truncated”:false,”viewable”:true,”workflowRedirectUrl”:null,”symbols”:{“timed_out”:false,”not_analyzed”:false,”symbols”:[{“name”:”Building An Open Source Decentralized E-Book Search Engine”,”kind”:”section_1″,”ident_start”:2,”ident_end”:60,”extent_start”:0,”extent_end”:4768,”fully_qualified_name”:”Building An Open Source Decentralized E-Book Search Engine”,”ident_utf16″:{“start”:{“line_number”:0,”utf16_col”:2},”end”:{“line_number”:0,”utf16_col”:60}},”extent_utf16″:{“start”:{“line_number”:0,”utf16_col”:0},”end”:{“line_number”:121,”utf16_col”:0}}},{“name”:”Step 1 – Initialize the Project”,”kind”:”section_3″,”ident_start”:836,”ident_end”:867,”extent_start”:832,”extent_end”:1112,”fully_qualified_name”:”Step 1 – Initialize the Project”,”ident_utf16″:{“start”:{“line_number”:6,”utf16_col”:4},”end”:{“line_number”:6,”utf16_col”:35}},”extent_utf16″:{“start”:{“line_number”:6,”utf16_col”:0},”end”:{“line_number”:16,”utf16_col”:0}}},{“name”:”**JavaScript**”,”kind”:”section_4″,”ident_start”:1041,”ident_end”:1055,”extent_start”:1036,”extent_end”:1112,”fully_qualified_name”:”**JavaScript**”,”ident_utf16″:{“start”:{“line_number”:11,”utf16_col”:5},”end”:{“line_number”:11,”utf16_col”:19}},”extent_utf16″:{“start”:{“line_number”:11,”utf16_col”:0},”end”:{“line_number”:16,”utf16_col”:0}}},{“name”:”**Python**”,”kind”:”section_3″,”ident_start”:1116,”ident_end”:1126,”extent_start”:1112,”extent_end”:1186,”fully_qualified_name”:”**Python**”,”ident_utf16″:{“start”:{“line_number”:16,”utf16_col”:4},”end”:{“line_number”:16,”utf16_col”:14}},”extent_utf16″:{“start”:{“line_number”:16,”utf16_col”:0},”end”:{“line_number”:23,”utf16_col”:0}}},{“name”:”Step 2 – Connect to the Network”,”kind”:”section_3″,”ident_start”:1190,”ident_end”:1221,”extent_start”:1186,”extent_end”:2035,”fully_qualified_name”:”Step 2 – Connect to the Network”,”ident_utf16″:{“start”:{“line_number”:23,”utf16_col”:4},”end”:{“line_number”:23,”utf16_col”:35}},”extent_utf16″:{“start”:{“line_number”:23,”utf16_col”:0},”end”:{“line_number”:49,”utf16_col”:0}}},{“name”:”**JavaScript**”,”kind”:”section_4″,”ident_start”:1429,”ident_end”:1443,”extent_start”:1424,”extent_end”:2035,”fully_qualified_name”:”**JavaScript**”,”ident_utf16″:{“start”:{“line_number”:29,”utf16_col”:5},”end”:{“line_number”:29,”utf16_col”:19}},”extent_utf16″:{“start”:{“line_number”:29,”utf16_col”:0},”end”:{“line_number”:49,”utf16_col”:0}}},{“name”:”**Python**”,”kind”:”section_3″,”ident_start”:2039,”ident_end”:2049,”extent_start”:2035,”extent_end”:2654,”fully_qualified_name”:”**Python**”,”ident_utf16″:{“start”:{“line_number”:49,”utf16_col”:4},”end”:{“line_number”:49,”utf16_col”:14}},”extent_utf16″:{“start”:{“line_number”:49,”utf16_col”:0},”end”:{“line_number”:72,”utf16_col”:0}}},{“name”:”Step 3 – Build Search Function”,”kind”:”section_3″,”ident_start”:2658,”ident_end”:2688,”extent_start”:2654,”extent_end”:3431,”fully_qualified_name”:”Step 3 – Build Search Function”,”ident_utf16″:{“start”:{“line_number”:72,”utf16_col”:4},”end”:{“line_number”:72,”utf16_col”:34}},”extent_utf16″:{“start”:{“line_number”:72,”utf16_col”:0},”end”:{“line_number”:94,”utf16_col”:0}}},{“name”:”**JavaScript**”,”kind”:”section_4″,”ident_start”:2904,”ident_end”:2918,”extent_start”:2899,”extent_end”:3431,”fully_qualified_name”:”**JavaScript**”,”ident_utf16″:{“start”:{“line_number”:78,”utf16_col”:5},”end”:{“line_number”:78,”utf16_col”:19}},”extent_utf16″:{“start”:{“line_number”:78,”utf16_col”:0},”end”:{“line_number”:94,”utf16_col”:0}}},{“name”:”**Python**”,”kind”:”section_3″,”ident_start”:3435,”ident_end”:3445,”extent_start”:3431,”extent_end”:3943,”fully_qualified_name”:”**Python**”,”ident_utf16″:{“start”:{“line_number”:94,”utf16_col”:4},”end”:{“line_number”:94,”utf16_col”:14}},”extent_utf16″:{“start”:{“line_number”:94,”utf16_col”:0},”end”:{“line_number”:112,”utf16_col”:0}}},{“name”:”Step 4 – Display Search Results”,”kind”:”section_3″,”ident_start”:3947,”ident_end”:3978,”extent_start”:3943,”extent_end”:4768,”fully_qualified_name”:”Step 4 – Display Search Results”,”ident_utf16″:{“start”:{“line_number”:112,”utf16_col”:4},”end”:{“line_number”:112,”utf16_col”:35}},”extent_utf16″:{“start”:{“line_number”:112,”utf16_col”:0},”end”:{“line_number”:121,”utf16_col”:0}}}]}},”copilotInfo”:null,”copilotAccessAllowed”:false,”csrf_tokens”:{“/j2qk3b/ebook-demo/branches”:{“put up”:”J2CJXIS491acpA-9gtZZBHEV6SMZbOXGMHKn4LZQYPTuv9xEq10TsUWM7DFwXANCARiOxekcdL8xxr5xkUVT8A”},”/repos/preferences”:{“put up”:”obZ5NX2U3rJZuJhDt-O1VFyPo6gm1G3KFrkogKTodPhtJXbldJAJi5GFKFDENl9yMhuF3XJV-LCPmONBx3Q4BA”}}},”title”:”ebook-demo/tutorial.md at predominant · j2qk3b/ebook-demo”}