You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2010/01/10 06:19:31 UTC

[Solr Wiki] Update of "PacktBook2009" by DavidSmiley

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "PacktBook2009" page has been changed by DavidSmiley.
The comment on this change is: Noted multi-terms in trie implementation; ms() function supplanting need for rord/ord for dates..
http://wiki.apache.org/solr/PacktBook2009?action=diff&rev1=6&rev2=7

--------------------------------------------------

  == Chapter 2: Schema and Text Analysis ==
  
  === Trie based field types ===
- The schema.xml used in the book examples has a schema version 1.1 instead of 1.2 which is Solr 1.4's new default. The distinction is fairly trivial.  The bigger difference is that Solr 1.4 defines a set of "Trie" based field types which are used in preference to the "Sortable" based ones.  For example, there is now a `TrieIntField` using a field type named `tint` which is to be used in preference to `SortableIntField` with a field type named `sint`.  The trie field types have improved performance characteristics, particularly for range queries, and they are of course sortable.  However, the "Sortable" field variants still do one thing that the trie based fields cannot do which is the ability to specify `sortMissingLast` and `sortMissingFirst`.  There is further documentation about these field types in the [[http://svn.apache.org/viewvc/lucene/solr/tags/release-1.4.0/example/solr/conf/schema.xml?revision=834197&view=markup|Solr 1.4 example schema.xml file]].
+ The schema.xml used in the book examples has a schema version 1.1 instead of 1.2 which is Solr 1.4's new default. The distinction is fairly trivial.  The bigger difference is that Solr 1.4 defines a set of "Trie" based field types which are used in preference to the "Sortable" based ones.  For example, there is now a `TrieIntField` using a field type named `tint` which is to be used in preference to `SortableIntField` with a field type named `sint`.  There is a trie based date as well now occupying the type name `date`, pushing aside the former implementation to `pdate`.  The trie field types have improved performance characteristics, particularly for range queries, and they are of course sortable.  However, the "Sortable" field variants still do one thing that the trie based fields cannot do which is the ability to specify `sortMissingLast` and `sortMissingFirst`.  There is further documentation about these field types in the [[http://svn.apache.org/viewvc/lucene/solr/tags/release-1.4.0/example/solr/conf/schema.xml?revision=834197&view=markup|Solr 1.4 example schema.xml file]].
+ 
+ Understand that the trie based dates internally use multiple indexed terms to function.  There are areas of Solr that require fields containing no more than one underlying indexed term.  For example, the function queries `ord` and `rord` have this requirement on its argument.  When encountering this limitation, don't use a trie date (or index both ways).
  
  === Text Analysis ===
   * !ReverseWildcardFilter
@@ -135, +137 @@

   * ms(), ms(x), ms(x,y)
  The `ms` function deals with times in milliseconds since the common 1970 epoch.  Arguments either refer to a date field or it is a literal (ex: 2000-01-01T00:00:00Z ).  Without arguments it returns the current time.  One argument will return the time referenced, probably a field reference.  When there are two, it returns the difference `x-y`. This function is useful when boosting more recent documents sooner. There is excellent information on this subject [[SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents|at the wiki]].
  
+ NOTE: The examples involving sorting on dates in the chapter were based on the non-trie based "pdate" date type (i.e. `solr.Date class`).  Use of `rord` and `ord` won't work with trie field types.  But with the addition of the much needed `ms` function, it's moot since you can simply use this function in place of `rord` and `ord` in a date based situation.
+ 
   * Function Range Queries
  Functions Queries can also be used for filtering searches.  Using the `frange` QParserPlugin, you specify a numeric range applied on the given function query.  This advanced technique is best described at 
  [[http://www.lucidimagination.com/blog/2009/07/06/ranges-over-functions-in-solr-14/|Yonik's blog post]] at Lucid Imationation.