Section Search

Search Tips

Section Search Tips

At the top of some sections of the Whitman Archive, a search box appears that allows you to search the documents associated with that specific section. Unless otherwise noted, these section searches return a default list of results sorted by search query relevance. These searches currently use Solr, a search server based on the Lucene Java search library.

In Solr, a search query is broken up into terms and operators. There are two types of terms: single terms and phrases. A single term is a single word such as "test" or "hello" (without quotation marks). A phrase is a group of words surrounded by double quotation marks such as "hello dolly". Multiple terms can be combined together with Boolean operators to form a more complex query (see below). Solr supports modifying query terms to provide a wide range of searching options.

Currently the Whitman Archive implementation of Solr prioritizes results that best match phrases, but also uses stemming to generate a wider range of results for both single term and phrase searches.

Wildcard Searches

Solr supports single and multiple character wildcard searches within single terms (not within phrase queries).

To perform a single character wildcard search use the "?" symbol. The single character wildcard search looks for terms that match that with the single character replaced. For example, to search for "text" or "test" you can use the search:

te?t

To perform a multiple character wildcard search use the "*" symbol. Multiple character wildcard searches looks for 0 or more characters. For example, to search for test, tests or tester, you can use the search:

test*

You can also use the wildcard searches in the middle of a term.

te*t

Fuzzy Searches

Solr supports fuzzy searches based on the Levenshtein Distance, or Edit Distance algorithm. To do a fuzzy search use the tilde ("~") symbol at the end of a single term. For example, to search for a term similar in spelling to "roam," use the fuzzy search:

roam~

This search will find terms like foam and roams.

Proximity Searches

Solr supports finding words are a within a specific distance away. To do a proximity search use the tilde ("~") symbol at the end of a phrase. For example, to search for "tears" and "undried" within 10 words of each other in a document, use the search:

"tears undried"~10

Boolean Operators

Boolean operators allow terms to be combined through logic operators. Solr supports AND, "+", OR, NOT and "-" as Boolean operators (Note: Boolean operators must be ALL CAPS).


OR

The OR operator is the default conjunction operator. This means that if there is no Boolean operator between two terms, the OR operator is used. The OR operator links two terms and finds a matching document if either of the terms exist in a document. The symbol || can be used in place of the word OR.

To search for documents that contain either "foolish passion" or just "foolish" use the query:

"foolish passion" foolish

or

"foolish passion" OR foolish


AND

The AND operator matches documents where both terms exist anywhere in the text of a single document. The symbol && can be used in place of the word AND.

To search for documents that contain "American government" and "George Washington" use the query:

"American government" AND "George Washington"


NOT

The NOT operator excludes documents that contain the term after NOT. The symbol ! can be used in place of the word NOT.

To search for documents that contain "books" but not "poetry" use the query:

books NOT poetry

Note: The NOT operator cannot be used with just one term. For example, the following search will return no results:

NOT poetry


-

Similar to the NOT operator, the "-" or prohibit operator excludes documents that contain the term after the "-" symbol.

To search for documents that contain "New Orleans" but not "the Crescent" use the query:

"New Orleans" -"the Crescent"

Grouping

Solr supports using parentheses to group clauses to form subqueries. This can be very useful if you want to control the Boolean logic for a query.

To search for either "fugitive" or "free" and "America" use the query:

(fugitive OR free) AND America

This eliminates any confusion and makes sure that America must exist and either term fugitive or free may exist.

Special Characters

Solr supports escaping special characters that are part of the query syntax. Eventually we hope to get this functionality working on the Whitman Archive instance of Solr, but we have not yet done so. Searches that include the following special characters will NOT generate results at this time:

+ - & || ! ( ) { } [ ] ^ " ~ * ? : \


Comments?

Published Works | In Whitman's Hand | Life & Letters | Commentary | Resources | Pictures & Sound

Support the Archive | About the Archive

Distributed under a Creative Commons License. Matt Cohen, Ed Folsom, & Kenneth M. Price, editors.