Skip to content
This repository has been archived by the owner on Apr 20, 2019. It is now read-only.

Hosting autocompeter yourself #9

Open
EtienneBruines opened this issue Apr 16, 2015 · 1 comment
Open

Hosting autocompeter yourself #9

EtienneBruines opened this issue Apr 16, 2015 · 1 comment

Comments

@EtienneBruines
Copy link

Hi,

First of all: nice effort in autocompeter.

I noticed...

I couldn't help but noticing that one can override the url variable. Even though this might not have been the intention (when you built it), it allows one to host their own autocompeter server.

One could...

I can imagine this being useful, when the backend is in Go as well. One could simply go get your library, and set up their own autocompeter endpoint. One could call

http.HandleFunc("/search/api", autocompeter.SearchHandler)

in combination with

<script>
var q = document.getElementById("q");
Autocompeter(q, {
            url: '/search/api',
            ping: false     // not needed as it can be hosted at the same domain
});
</script>

Reasons for wanting this include:

  • Privacy (I don't really imagine this to be an issue, but doing this allows one to use this search engine for protected websites that require the user to be logged in);
  • Faster updating (even though your API is probably fast, not having to go across the web to do it, is faster)
  • Uptime "guarantee": when the website is online, then chances are quite big the search-engine is online as well
  • Less traffic/requests to autocompeter.com

One only needs...

...a back-end for the searching.

Now I have successfully implemented a simple back-end for such purpose: using the same technique as you described. I'm using Go map[string][]int for that, which might be less efficient than Redit (I'm not a Redis-user), but as it's not making calls across processes, it should be faster for small databases. As such, it is only in-memory. But it allows you to easily (programmatically) update the database without using the Api to autocompeter.com/v1.

If you can, I can wrap this up nicely and make a PR for this, and put some effort in making it publicly available. If you don't like the idea (or would like some adjustments), feel free to discuss.

@peterbe
Copy link
Owner

peterbe commented Apr 17, 2015

Autocompeter is deliberately built so that other companies can download it and install it on their own server. I'm running my own instance on https://autocompeter.com for fun and for my own sites.

A in-memory version that does the same thing is an interesting idea. I'm not convinced though. I have one user on autocompeter.com that uploaded 106,000 titles. If I was to store that in memory across, say, 5 processors it would be enormous in size. And Redis is already fast enough. And an efficient store.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants