PS Birch (yagaysgs) wrote in lj_everywhere,
PS Birch

Livejournal Searching Utility v1.2-Pub

Hallo all,

As promised, here's the util I wrote to do fulltext searches of your livejournal installs.

Livejournal Searching Utility v1.2-Pub 2/23/05
by Peter Sanderson, et al

The files released here were written by Peter Sanderson for the livejournal
server installation at The Pittsburgh Supercomputer Center. In no way will
he or the PSC be liable for any damages caused by its use. It is distributed
free of charge under the general licenses "Don't Make Money Off Of Other
People's Work" and "If You Like It, Feel Free To Send Beer," and the request
to give credit to the author and his sources should you use the code.

As most everyone knows, there is no built in functionality in the lj server
to do fulltext searches. Many in the lj_everywhere community have bemoaned
this fact, especially since we have our lj servers behind firewalls where
the likes of Google, Altavista, and Lycos can't see it. Seeking to rectify
this situation, I poked around and found a php script written by Kevin Phillips
of, got my bearings, and ploughed ahead.

The ljsearch.html utility allows for fulltext searching on livejournal entries
via the back-end. It is written entirely in python. It provides
the following functionality:
- Searching the entire depth of a user's journal
- Searching the journals of an entire livejournal db
- Searching a user's subject and/or entry text
- Searching with or without regard to case
- String, Boolean OR, or Boolean AND matching
- Sorting results by username or by data
- Formatting of results

Consists of four files:
- This readme.txt
- ljsearch.html
Python script that should be placed in LJHOME/cgi-bin
Python script that should be placed in LJHOME/cgi-bin
- ljminisearch.html
A single line version of the submit form

1) These scripts require python 2.0 or greater
To discover if you have python installed on your server,
type 'which python' on the command line. Be sure that the
python path in both ljsearch.html and is then set
correctly. #!/usr/bin/python is the default
2) These scripts assume a lj database schema as presently exists.
Should lj ever change their db, a new version of this script
will appear at
3) Within the scripts are the following variables, which must
be changed for each installation:
DB_HOSTNAME The full path to connect to your lj db server, ie ''
DB_USER The name of the lj SQL user on your lj db serve, ie, 'lj'
DB_PASSWD The SQL passwd for that user, ie 'swordfish'
HOSTNAME The fullpath to connect to your lj server, ie, ''
HOSTNAME The fullpath to connect to your lj server, ie, ''

Useful Trivia:
- You may, if you like, use the single line contained within ljminisearch.html to add a
searchbox to your lj user pages. My suggestion would be to append the line to the
contained in s1styles.dat. Similarly, I have also added a link to the html file in
both my Calendar and Friends views to make it easily accessible.
- I prefer Kalamazoo Brewing Company (Bell's), Victory, and Dogfish Head IPAs, though
ambers, browns, stouts, and pils are all very good

Please feel free to contact with any questions, including where to
send the beer

  • Post a new comment


    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded