Searching the LilyPond Snippet Repository

Brandenburgische Konzert 3 (J.S. Bach)Using the search facilities of the LilyPond Snippet Repository is easy. If you type some words LSR will search for them in titles, description texts and snippets. All words must be present in at least one of the three for a snippet to appear. Documents are then ranked using the number of times the words appear, and the distance between them. Some special characters, such as #, require a backslash in front to be interpreted as a standard character (e.g., you must write \#UP to search for “#UP”).

If you want to go further, LSR provides some of the most sophisticated search facilities available, being based on MG4J, a research search engine.

First of all, LSR is made of three separate indices: title, text and snippet. If you want, you can ask for a specific term to appear in just one index by prefixing the term with the index name, followed by a colon. Thus, snippet:fermata searches for “fermata” just in the snippets, and nowhere else.

There is a stemming operator * that searches for all terms starting with a given prefix: beam* will search for “beam” as well as “beams”, “beamed” and so on (there is a limit on the amount of stemming you can do, however).

You can create more complex queries using the AND operator (a.k.a. &, or just juxtaposition of terms) or using the OR operator (a.k.a. |). Thus, beam | beams will search for any of the words “beam” and “beams” in all indices, whereas title:beam text:beams searches for “beam” in titles and “beams” in the snippet description text. You can also surround lists of words with double quotes, and words will be searched for in that sequence: "one beam" will search exactly for the two-word sequence “one beam”.

If you do not want some query to be satisfied, just add an exclamation mark in front of it. ! beams finds pages where the word “beams” does not appear. beam* ! automatic searches for “beam”, “beams”, “beamed”, etc. but just where “automatic” does not appear.

You can always use parentheses to group correctly parts of a query. For instance, if you want to search for “beam” or “beams” in titles, just use title:(beam OR beams)

A more sophisticated modifier is interval restriction: if you surround a query with ()~k, where k is an integer, only documents satisfying the query within regions of text shorter than k will be returned. Now, if the query is a query combining with & several terms, the result is clear. But MG4J can make a sense of it for any query. So text:(one beam | two beams)~5 will search for snippets in whose description either “one” and “beam” or “two” and “beams” appear at most at distance five (i.e., with at most three words in the middle).

If you're really adventurous, you can search for several terms in a specified order using the < (ordered conjunction) operator. So line < break will search for “line” and “break”, but only in this order. A document containing one occurrence of “break” followed by one occurrence of “line” won't match.


If you find something that does not appear to work as it should (wrong ranking, badly formatted images, non-working snippets, horrible Java stack traces from Tomcat, whatever), please write me an e-mail.