Searching - Paperight/website GitHub Wiki

Searching for books on Paperight: there are simple searches, advanced searches, and super-special searches. (The latter doesn't exist yet, as of 3 Aug 2012).

  • Simple search: type into the search bar and see what comes up. This is what 99% of users will do.
  • Advanced search: While UI hasn't been developed yet, it is possible to search for specific kinds of items using special URLs. This is described below.
  • Super-special searches: Eventually, we will have the ability to search for things that belong to a specific person, by entering a special, password-like code into the search bar. (E.g. we SMS a code like 'UNI335LFO' to a student, and that is their special code for accessing the textbooks they need for their UNISA course.)

Advanced search URLs

To get an advanced-search result, you have to send the server instructions about what you want by putting your request in a URL. Eventually, users will use a form on the site to automatically create these URLs; but for now, we write them manually. Here is how.

Example: http://www.paperight.com/search/advanced?publisher=modjaji

This URL fetches all books where the word 'modjaji' is part of the publisher name.

The first part is the root of the advanced search:

http://www.paperight.com/search/advanced

On its own, that URL does nothing. You have to add instructions. Start those instructions by adding a question mark:

http://www.paperight.com/search/advanced?

Then you add a field name. Choose from:

title creator publisher tags subjectArea

Technically, these are called GET variables, kind of because they ask the browser to 'get' data from the database. So if you want to search just book titles, you might have:

http://www.paperight.com/search/advanced?title

Now, what do you want to find in titles? Let's say books with the word 'adventures' in them. So you want the 'title' to equal 'adventures', right? So:

http://www.paperight.com/search/advanced?title=adventures

That URL will now work. It will find all books where the word 'adventures' is in the title. (If you had written 'advent' only, you'd get titles with that in the title, including 'advent', 'adventure', 'adventures', 'adventuring', etc.)

You can do more, though. Let's say you want to search two fields. Say, you want all books with 'adventures' in the title by Mark Twain. You simply add another field search to your URL with an ampersand (an 'and' sign, &):

http://www.paperight.com/search/advanced?title=adventures&creator=twain

Now for more power. Say you want to search for all books with 'man' in the title tagged with either women or Philosophy. You can list the options in the URL, separated with a comma:

http://www.41.72.154.246:8080/search/advanced?title=man&tags=women,Philosophy

This will find all products where the title contains 'man' and the tags 'women' or 'Philosophy'. Or try:

publisher=Cingela,Siyavula

You can use and within fields with a +, as in normal search, e.g.:

publisher=Oxford+University+Press