PDA

View Full Version : Need to modify your "google internal search script" to work on a collection of files



Mitanoff
08-19-2015, 05:12 PM
Hello:

I have a collection of files that have been shadowed to several world wide locations. Every location has a different subset of files.
It is not a web server.
At these remote sites, the user would like to search through their entire file directory (html files) for key terms - e.g. "Error Code : 3006" and be able to identify which html files contain the search term. I am restricted from using shareware etc. .

I'm hoping that the script " Google Internal Site Search script- By JavaScriptKit.com (http://www.javascriptkit.com)" will work for me.

My problem is the URL.

I modified the script like so (not all script info shown):

5715

And the result is:
5716

If I remove the word "site:" from the code, I get a NaN response - I'm guessing the forward slashes aren't being interpreted correctly.
"function Gsitesearch(curobj){
curobj.q.value="site:"+YourDomain_proper+" "+curobj.qfront.value
}
"

Even though I have little-to-no knowledge of javascript, I have been tasked with coming up with a search tool for this private site, and I am not a programmer. But it is what it is and I am trying to make the best of it by smashing pieces of code together. Perhaps this isn't even the best way to go?
If this is an easy fix, please let me know. If you think this is not an appropriate tool and can suggest something else, I would be all ears.

Please be gentle.
Thanks.

Beverleyh
08-19-2015, 07:13 PM
I'm not sure what Google search script you're referring to in the JavaScriptKit site but a Google "site:" search is a standard function that is run through Google. It is the equivalent of manually going to Google and punching in " site:http://website.com " - that's going to pull up all the pages for "http://website.com". The script will be acting as an intermediary and passing a keyword to this Google "site:" search, but once it does that, it's out in the wild; on the live web and at the mercy of Google's stored data (and whatever it wants to spit back as the result).

So, first prerequisite is that you are connected to the Internet and able to access Google (no firewalls or filters blocking access).

The second prerequisite is that the "site:" operator must be present for Google to recognise the search as being from the specified website (only results from "http://website.com" rather than the whole web). Removing it from the script will kill the search.

The third prerequisite is that your website is on the live web and already indexed by Google. You say that your site is not (on) a web server so is it running locally? If so, this unfortunately isn't going to be the script for you.

Usually, a search engine script would require a server and database to run, but I know of a flat file script that you can hardcode search terms in to. It's called Tipue. http://www.tipue.com/search/ I'm going back about 10 years now, but I used a really old version in a desktop "website" that several people accessed from a local network - sounds a bit like your situation. The developers went quiet for a few years but it looks like an updated version is now released. I haven't explored the updates but the website says this;
Static mode can be used without a web server, and without an internet connection if you load jQuery locally.http://www.tipue.com/search/docs/?d=4

The documentation is very good so you should hopefully be able to get at working OK.

The downside is that all your keywords (search terms) will need to be pre-empted and hard coded into a file. From memory, it was an array where, for each page/file, you define a title that displays in the results page, a series of important keywords that will flag each page/file, and a relative path link/reference to each page/file so that it will launch when a search result is clicked.

Hope that helps

Mitanoff
08-21-2015, 03:49 PM
Hello Bev:

Thank you for your quick response and a possible alternate solution. Appreciate it !