{"action":"opened","issue":{"url":"https://api.github.com/repos/ipfs/faq/issues/149","repository_url":"https://api.github.com/repos/ipfs/faq","labels_url":"https://api.github.com/repos/ipfs/faq/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/ipfs/faq/issues/149/comments","events_url":"https://api.github.com/repos/ipfs/faq/issues/149/events","html_url":"https://github.com/ipfs/faq/issues/149","id":168079384,"number":149,"title":"Keyword search for web application","user":{"login":"Ekliptor","id":14872773,"avatar_url":"https://avatars.githubusercontent.com/u/14872773?v=3","gravatar_id":"","url":"https://api.github.com/users/Ekliptor","html_url":"https://github.com/Ekliptor","followers_url":"https://api.github.com/users/Ekliptor/followers","following_url":"https://api.github.com/users/Ekliptor/following{/other_user}","gists_url":"https://api.github.com/users/Ekliptor/gists{/gist_id}","starred_url":"https://api.github.com/users/Ekliptor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ekliptor/subscriptions","organizations_url":"https://api.github.com/users/Ekliptor/orgs","repos_url":"https://api.github.com/users/Ekliptor/repos","events_url":"https://api.github.com/users/Ekliptor/events{/privacy}","received_events_url":"https://api.github.com/users/Ekliptor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-28T12:02:49Z","updated_at":"2016-07-28T12:02:49Z","closed_at":null,"body":"How could I implement a keyword search for a web application?\r\nI have read this topic about dynamic content: https://github.com/ipfs/faq/issues/28\r\nBut keyword items are public, not private.\r\n\r\nLet's assume the following use case:\r\n- a web app where EVERY user can publish items under keywords\r\n- all items and their keywords are considered public (read-only)\r\n\r\nI understand that there is no server side script or central database with an index. So the browser with javascript could do something like this:\r\n`let keywordHash = someHashFunction(\"MyKeyword\"); // SHA2 or something similar`\r\n`let results = ipfsFind(keywordHash);`\r\n`for (let result of results) // loop through results and download the desired items`\r\n\r\n1. What about publishing and searching for multiple keywords in your DHT? The best approach should be to publish them under all keyword hashes. (Only then can users find them under every single keyword.)\r\nNormalizing spaces/word-separators and publishing every possible keyword combination for a phrase of length n would require 2^n publications.\r\n2. Should I add a prefix to all my keywords to avoid conflicts with potential other apps when searching for common keywords?\r\n`let keywordHash = someHashFunction(appPrefix + \"MyKeyword\");`\r\n\r\n\r\nAlternatively my app could built a database file where every user can write new entries to and load it for every user on when the user opens the app. Search results would appear instantly, but it's not scalable for larger indices?\r\n\r\nOr is there already an official IPFS search API in development? I assume more apps would require something like that?\r\nOr is it your intention that every app should deal with this on its own? In that case a reference implementation might still be helpful."}}
{"actor":{"display_login":"Ekliptor"}}