![]() |
||||||||||
|
Searching |
||||||||||
|
To locate a subset of items that match some criteria, you type a search string into the Query Pane at the top of the main window. If you just type one or more words, Parsnips will display all the items that have those words anywhere in the title, keywords, or main text of the item. Parsnips also supports more sophisticated searches, allowing you to search for combinations of words or phrases, exclude items with certain words, and to search only in the text, title, or keyword fields. For the more complex searches, you should initially use the Query Builder panel. This is displayed by clicking the Query Builder... label in the right side of the Query Pane. After you compose a few queries using this panel and see what query string is generated, you will learn how to type advanced queries by hand. Note: Parsnips uses the Lucene search engine library. The following discussion of query syntax is based upon the Lucene documentation. The general syntax for queries is as follows: 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 test or hello. A Phrase is a group of words surrounded by double quotes such as "hello dolly". Multiple terms can be combined together with Boolean operators to form a more complex query (see below). Fields You can search any field by typing the field name followed by a colon ":", followed by the term you are looking for. If no field is specified then all fields are searched by default. As an example, if you want to find the item entitled "The Right Way" which contains the text "don't go this way", you can enter: title:"The Right Way" AND contents:go Term Modifiers 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 "text" or "test" you can use the search:
Multiple character wildcard searches looks for 0 or more characters. For example, to search for test, tests or tester, you can use the search:
You can also use the wildcard searches in the middle of a term.
Note: You cannot use a * or ? symbol as the first character of a search. Boolean operators OR To search for documents that contain either "jakarta apache" or just "jakarta" use the query: "jakarta apache" jakarta or "jakarta apache" OR jakarta AND To search for documents that contain "jakarta apache" and "jakarta lucene" use the query: "jakarta apache" AND "jakarta lucene" NOT To search for items that contain "jakarta apache" but not "jakarta lucene" use the query: "jakarta apache" NOT "jakarta lucene" Note: The NOT operator cannot be used with just one term. For example, the following search will return no results: NOT "jakarta apache" This is a limitation of the Lucene search engine. You can work around it by using the Query Builder to choose a Date range to go along with the NOT term. Grouping Parsnips 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 "jakarta" or "apache" and "website" use the query: (jakarta OR apache) AND website This eliminates any confusion and makes sure that "website" must exist and one or both of the terms "jakarta" and "apache" must exist. Field Grouping Parsnips supports using parentheses to group multiple clauses to a single field. To search for a title that contains both the word "return" and the phrase "pink panther" use the query: title:(return AND "pink panther") Escaping Special Characters Parsnips supports escaping special characters that are part of the query syntax. The current list of special characters are + - && || ! ( ) { } [ ] ^ " ~ * ? : \ To escape any of these characters use the \ before the character. For example to search for (1+1):2 use the query: \(1\+1\)\:2
There are additional capabilities of the Lucene search engine that are not described here. For example, there are proximity searches and range searches. To learn more about these see Lucene's Query Syntax document. |
||||||||||