Introducción a Zend Framework

 Aprendiendo Zend Framework

Apéndice

 Referencia de Zend Framework


  • Zend_Gdata
  • Zend_Http
  • Zend_InfoCard
  • Zend_Json
  • Zend_Layout
  • Zend_Ldap
  • Zend_Loader
  • Zend_Locale
  • Zend_Log
  • Zend_Mail
  • Zend_Markup
  • Zend_Measure
  • Zend_Memory
  • Zend_Mime
  • Zend_Navigation
  • Zend_Oauth
  • Zend_OpenId
  • Zend_Paginator
  • Zend_Pdf
  • Zend_ProgressBar
  • Zend_Queue
  • Zend_Reflection
  • Zend_Registry
  • Zend_Rest

  • Zend_Search_Lucene
  • Zend_Serializer
  • Zend_Server
  • Zend_Service
  • Zend_Session
  • Zend_Soap
  • Zend_Tag
  • Zend_Test
  • Zend_Text
  • Zend_TimeSync
  • Zend_Tool
  • Zend_Tool_Framework
  • Zend_Tool_Project
  • Zend_Translate
  • Zend_Uri
  • Zend_Validate
  • Zend_Version
  • Zend_View
  • Zend_Wildfire
  • Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Traducción al 26.9% - Actualizado el 2011-11-16 - Revisión 24249 - Versión ZF 1.11.x

    10.6. 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.

    Ejemplo 10.10. Querying for a single word

    hello

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


    [Nota] 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.

    Ejemplo 10.11. Querying for multiple words

    hello dolly

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


    Ejemplo 10.12. Requiring words in a query

    +hello dolly

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


    Ejemplo 10.13. Prohibiting words in queried documents

    +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.


    Ejemplo 10.14. Querying for phrases

    "hello dolly"

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


    Ejemplo 10.15. Querying against specific fields

    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.


    Ejemplo 10.16. Querying against specific fields as well as the entire document

    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.


    Ejemplo 10.17. Querying against specific fields as well as the entire document (alternate)

    title:Do it right

    Searches for the word "Do" within the title field and the words "it" and "right" words through all fields; any single one matching will result in a document match.


    Ejemplo 10.18. Querying with the wildcard "?"

    te?t

    Search for words matching the pattern "te?t", where "?" is any single character.


    Ejemplo 10.19. Querying with the wildcard "*"

    test*

    Search for words matching the pattern "test*", where "*" is any sequence of zero or more characters.


    Ejemplo 10.20. Querying for an inclusive range of terms

    mod_date:[20020101 TO 20030101]

    Search for the range of terms (inclusive).


    Ejemplo 10.21. Querying for an exclusive range of terms

    title:{Aida to Carmen}

    Search for the range of terms (exclusive).


    Ejemplo 10.22. Fuzzy searches

    roam~

    Fuzzy search for the word "roam".


    Ejemplo 10.23. Boolean searches

    (framework OR library) AND php

    Boolean query.


    All supported queries can be constructed through Zend_Search_Lucene's query construction API. Moreover, query parsing and query constructing may be combined:

    Ejemplo 10.24. Combining parsed and constructed queries

    $userQuery Zend_Search_Lucene_Search_QueryParser::parse($queryStr);

    $query = new Zend_Search_Lucene_Search_Query_Boolean();
    $query->addSubquery($userQuerytrue  /* required */);
    $query->addSubquery($constructedQuerytrue  /* required */);

    digg delicious meneame google twitter technorati facebook

    Comentarios

    Loading...