Skip to content
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

Break-up search? #51

Open
sbbic opened this issue Aug 28, 2014 · 9 comments
Open

Break-up search? #51

sbbic opened this issue Aug 28, 2014 · 9 comments

Comments

@sbbic
Copy link

sbbic commented Aug 28, 2014

Searching for words seems to be very time-intensive (though kudos because it works with Khmer - very few programs can search Khmer out of the box!), I wonder if paginating results and only searching enough to fill one page at a time would reduce load time. I know having the search graph is cool, but it took over 5 minutes for search results to appear (unless I am doing something wrong?).
Also the ability to filter the search (only search one book, the Gospels, etc) would be a wonderful feature.

EDIT: For some reason the search here http://www.biblewebapp.com/instant/ is way faster than the search here http://biblewebapp.com/study/. Any way to incorporate it? Possibly it is pre-indexed?

@alerque
Copy link
Contributor

alerque commented Aug 29, 2014

5 minutes sounds like you've got something configured wrong.

Keep in mind that the app was primarily designed for everything to happen client side so it could be run locally. The default search is doing a client side search, so it relies on the speed of your browser using Javascript to parse and find your matches. This makes sense when all the files are stored locally (say you are using the site from a USB stick rather than from the web) but it is silly in the context of an Internet hosted site that first has to download the entire Bible worth of HTML source files.

There are a couple of server side helpers available (e.g. for PHP and .NET backends). I believe you need to enable these in your config if you are hosting the site by setting up the path to the API. Check esp. the baseContentApiPath and serverSearchPath keys in your site config. That will let the app know what backed it should be talking to and I think it will figure out from there how to search without downloading everything!

// (1) Leave blank for local files or for CORS enabled CDN                    
// (2) Enter path of script that will convert all files to JSONP (e.g., api.php)
baseContentApiPath: '', 

// (1) Leave blank for JSON search                                            
// (2) Enter path of script that will return JSON data                        
serverSearchPath: '', 

@sbbic
Copy link
Author

sbbic commented Aug 29, 2014

Interesting.
http://biblewebapp.com/study/ is actually really slow for me as well...I assume that is configured correctly?

But I am willing to try. I am running this on a vps with nginx. I'm not sure what to use for the either. Do you have any idea how I can find the paths? I did a quick search on Google and didn't see anything...

@alerque
Copy link
Contributor

alerque commented Aug 29, 2014

@sbbic I don't know how that site is configured (I'm just an interested third party user/contributor, not the original author or hoster af that site!). Maybe @johndyer can speak to that situation.

The paths you are looking for are just the path to one of the back-end scripts in the main app directory. For example if you have a PHP backend you could give it the URL to the search.php file (as well as the PHP api file).

@sungkhum
Copy link

Logged into my normal profile (forgot to log out of the other one) - I tried changing the path to my absolute server path (/var/www/mywebsite/app), the url, the actual api.php/search.php and i keep getting the error:

Problem loading http://mywebsite/content/texts/texts.json

Status:undefined

Error:undefined

Not sure why.

@sungkhum
Copy link

sungkhum commented Sep 4, 2014

Search is also very slow here: http://ebible.org/study/

I am not sure if it is a configuration issue...that's three sites that are slow (including my beta site).

@sungkhum
Copy link

sungkhum commented Sep 4, 2014

Well, I just found http://inscript.org/ and its search is great! So maybe it is a configuration problem (maybe my server is too slow?)? Still haven't figured out what to put for baseContentApiPath: '', or serverSearchPath: '',

@sungkhum
Copy link

sungkhum commented Sep 4, 2014

Well, here's inscript.org's config:

    // where to get files
    baseContentUrl: 'http://biblecloud.net/',

    baseContentApiPath: 'api.php',

    // where to search
    serverSearchPath: 'search.php',

@johndyer
Copy link
Member

johndyer commented Sep 9, 2014

Right now the search can function in a few ways
(1) JavaScript can load each chapter file and look through them for search terms. Slowest
(2) JavaScript can load index files and then load matchin chapters. A bit faster
(3) JavaScript can hit a server and have it return direct results of matching verses. Fastest, depending on server speed

Right now for option 3, the server scripts (PHP and .NET) use the index files, loads the chapters, and parses out verses. This is the easiest way without a database, but it also uses expensive HTML parsing making it slower.

Some speedier options might include limiting the number of books searched.

@sungkhum
Copy link

sungkhum commented Sep 9, 2014

My vote isn't really worth much because I can't be of help with the solution, but it would be great to have a database so the search can be faster (MySQL or whatever would work). The interface is so nice, just the search is slow.
But as I said in my previous comments, I can't seem to get the code to work using:

    baseContentApiPath: 'api.php',

    // where to search
    serverSearchPath: 'search.php',

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

No branches or pull requests

4 participants