Перевод "Getting Started with Zend_Search_Lucene. Supported queries"

Zend, “Getting Started with Zend_Search_Lucene. Supported queries”, public translation into Russian from English More about this translation.

See also 44 similar translations

Translate into another language.

Participants

Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next next untranslated
1 2

Getting Started with Zend_Search_Lucene. Supported queries

Zend_Search_Lucene and Java Lucene support a powerful query language. It allows searching for individual terms, phrases, ranges of terms; using wildcards and fuzzy search; combining queries using boolean operators; and so on.

A detailed query language description can be found in the Zend_Search_Lucene component documentation.

What follows are examples of some common query types and strategies.

Example #1 Querying for a single word

  01. hello

Searches for the word "hello" through all document fields.

    Note: Default search field

    Important note! Java Lucene searches only through the "contents" field by default, but Zend_Search_Lucene searches through all fields. This behavior can be modified using the Zend_Search_Lucene::setDefaultSearchField($fieldName) method. <br />

Example #2 Querying for multiple words

  01. hello dolly

Searches for two words. Both words are optional; at least one of them must be present in the result.

Example #3 Requiring words in a query

  01. +hello dolly

Searches for two words; "hello" is required, "dolly" is optional.

Example #4 Prohibiting words in queried documents

  01. +hello -dolly

Searches for two words; "hello" is required, 'dolly' is prohibited. In other words, if the document matches "hello", but contains the word "dolly", it will not be returned in the set of matches.

Example #5 Querying for phrases

  01. "hello dolly"

Searches for the phrase "hello dolly"; a document only matches if that exact string is present.

Example #6 Querying against specific fields

  01. title:"The Right Way" AND text:go

Searches for the phrase "The Right Way" within the title field and the word "go" within the text field.

Example #7 Querying against specific fields as well as the entire document

  01. title:"The Right Way" AND  go

Searches for the phrase "The Right Way" within the title field and the word "go" word appearing in any field of the document.

Example #8 Querying against specific fields as well as the entire document (alternate)

Pages: ← previous Ctrl next next untranslated
1 2