SEARCH HELP

HarrisburgPA.gov uses two advanced technologies to perform searches, Lucene and Google. Your choice to search either HarrisburgPA.gov itself or perform a broader World Wide Web search—possibly on something you read at HarrisburgPA.gov—determines how your search will be processed.

The Basics

In the upper right hand portion of each page is the Search form. The form consists of two choices for the “scope” of the search, a text field for entering what you want to search for, and a “GO” button.

A Simple Search

To perform simple search, follow these directions:

  1. Select the scope of the search.
    1. “This Site” searches only HarrisburgPA.gov.
    2. “The Web” uses Google to search the entire World Web Wide.
      Web Searches are powered by Google!
  2. Enter a word or phrase in the search text field.
  3. Click the “GO” button.

A More Advanced Search

The technologies used by each search engine determine the advanced options available.

“The Web”

A web search started from HarrisburgPA.gov is passed to Google for results. The advanced options available in the Google search engine are detailed at Google.com, and you are invited to learn more at Google’s Help pages. Remember, you can use Google’s advanced search features right from HarrisburgPA.gov. Just enter your search and click “GO”.

“This Site”

To perform HarrisburgPA.gov searches, we use Jakarta’s Lucene, a high-performance, full-featured text search engine written entirely in Java. Many advanced search features are available in Lucene. A detailed summary of Lucene’s advanced search capabilities, with some helpful explanation of how searches are performed, is detailed below.

Where Lucene is used, you will see
HarrisburgPA.gov search powered by The Jakarta Lucene Logo

Using HarrisburgPA.gov’s Advanced Search Features

The following information is provided for those wanting to perform specific searches on content available at HarrisburgPA.gov. It is likely a more basic search will be sufficent, but very broad. Using the information below will help you narrow your results to almost exactly what you were looking for. The following information was adapted from Jakarta Lucene’s documentation.

Queries

In technical jargon, a search is called a query.

Terms

A 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 “city” or “island”.

A Phrase is a group of words surrounded by double quotes such as “City Island”.

Multiple terms can be combined together with Boolean operators to form a more complex query (see below).

Fields

Lucene supports fielded data. When performing a search you can either specify a field, or use the default field.

You can search any field by typing the field name followed by a colon “:” and then the term you are looking for.

As an example, HarrisburgPA.gov provides two fields, title and content and content is the default field. If you want to find the document entitled “The Right Way” which contains the text “don’t go this way”, you can enter:

     title:“The Right Way” AND content:go

Since content is the default field, the field indicator is not required.

     title:“The Right Way” AND go

Note: The field is only valid for the term that it directly precedes, so the query

     title:Do it right

Will only find “Do” in the title field. It will find “it” and “right” in the default field (in this case the content field).

Term Modifiers

Lucene supports modifying query terms to provide a wide range of searching options.

Wildcard Searches

Lucene supports single and multiple character wildcard searches.

To perform a single character wildcard search use the “?” symbol.

To perform a multiple 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 “smell” or “smelt” you can use the search:

     smel?

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

Note: You cannot use a * or ? symbol as the first character of a search.

Fuzzy Searches

Lucene supports fuzzy searches. To do a fuzzy search use the tilde, “~”, symbol at the end of a Single word 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

Note:Terms found by the fuzzy search will automatically get a boost factor of 0.2 (see below for more information on boost factors).

Proximity Searches

Lucene supports finding words that are within a specified distance. To do a proximity search use the tilde, “~”, symbol at the end of a Phrase. For example to search for a “harrisburg” and “senators” within 10 words of each other in a document use the search:

     “harrisburg senators”~10

Boosting a Term

Lucene provides the relevance level of matching documents based on the terms found. To boost a term use the caret, “^”, symbol with a boost factor (a number) at the end of the term you are searching. The higher the boost factor, the more relevant the term will be.

Boosting allows you to control the relevance of a document by boosting its term. For example, if you are searching for

     city island

and you want the term “city” to be more relevant boost it using the ^ symbol along with the boost factor next to the term. You would type:

     city^4 island

This will make documents with the term city appear more relevant. You can also boost Phrase Terms as in the example:

     “city park”^4 “city island”

By default, the boost factor is 1. Although, the boost factor must be positive, it can be less than 1 (i.e. .2)

Boolean operators

Boolean operators allow terms to be combined through logic operators. Lucene 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.

To search for documents that contain either “harrisburg senators” or just “harrisburg” use the query:

     “harrisburg senators” harrisburg

or

     “harrisburg senators” OR harrisburg

AND

The AND operator matches documents where both terms exist anywhere in the text of a single document.

To search for documents that contain “harrisburg senators” and “harrisburg hotels” use the query:

     “harrisburg senators” AND “harrisburg hotels”

+

The “+” or required operator requires that the term after the “+” symbol exist somewhere in a field of a single document.

To search for documents that must contain “senators” and may contain “island” use the query:

     +senators island

NOT

The NOT operator excludes documents that contain the term after NOT.

To search for documents that contain “civil war” but not “harrisburg senators” use the query:

     “civil war” NOT “harrisburg senators”

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

     NOT “harrisburg senators”

-

The “-” or prohibit operator excludes documents that contain the term after the “-” symbol.

To search for documents that contain “city island” but not “city parking” use the query:

     “city island” -“city parking”

Grouping

Lucene supports using parentheses to group clauses to form sub queries. This can be very useful if you want to control the boolean logic for a query.

To search for either “harrisburg” or “parking” and “senators” use the query:

     (harrisburg OR parking) AND senators

This eliminates any confusion and makes sure you that senators must exist and either term harrisburg or parking may exist.

Escaping Special Characters

Lucene supports escaping special characters that are part of the query syntax. The current list special characters are

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

To escape these character use the \ before the character. For example to search for (1+1):2 use the query:

     \(1\+1\)\:2