-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement offline search API #11
Comments
One way might be to let use which attribute to search and we load an index file accordingly. |
You mean to choose attribute first, then search the correct index file? @heytitle |
Yes. We can also create a combined index file, but i'm not sure how hard it is to construct such a file. |
One idea is to create simple lookup index like this for all content types that are of our concerns. [
{ q: "สว", type: "page", url: "/cabinet" },
{ q: "พลเอก ประยุทธ์ จันทร์โอชา", type: "people", url: "/people/ประยุทธ์-จันทร์โอชา" },
{ q: "เพื่อไทย", type: "party", url: "/party/เพื่อไทย" },
{ q: "ขยายสัญญาสัมปทานทางด่วนและรถไฟฟ้าบีทีเอส", type: "votelog", url: "/votelog/3" },
// ... go on
] Then, partial matching of |
For word variations like "สว", we could do RegExp: [
{ q: "ส\.?ว.\?", match: "regexp", type: "page", url: "/cabinet" },
// ... go on
] |
@rapee let see if I understand correctly
|
That’s right @Th1nkK1D |
imho, we also have to check the size of the index file. If it shouldn't be too large. @rapee any idea about the reasonable file size? Given that this index file doesn't change regularly, we might cache it using local storage. In term of indexing, we might need to construct a search tree somehow for efficient look-ups. I'm not sure whether |
Idea proposed with prototype v1 implemented in PR #156 |
I think it's best to not exceed 500 KB. Storing on local storage is good idea. I haven't done benchmark search performance yet, but given the current number of indexed records are within 1,000, it might not be top priority. I think we implement the first version of search component first, then we can try exploring huffman and other ideas. |
We want to search across dataset (people / zipcode / party / vote logs). Can we do offline e.g. not loading external API?
Response body:
#11 (comment)
The text was updated successfully, but these errors were encountered: