Yoichi Kawasaki's Web

Jeff Bezos – 2010 Princeton Graduation Speech

April 6, 2014

Super inspiring speech given by Jeff Bezon for graduation speech at Princeton University. The part of the message that I love the most in the speech, and that I believe he wanted to carry the most is “we are our choices”, our life stories are built by the series of choices we have made. This simple but clear & striking message taught me how important our choices are, especially the ones regarding life decisions are. To be honest, I’ve made or tended to make choices based on what it appears right or what I intuitively think good to do at that time, not based on what I look for the future. I don’t know if the choices I’ve made so far will work good or bad to me of 80 years old, but I have to keep in mind that I need to make choices in my life so that I feel proud of telling my life story when I am 80 years old. Posting this just to share the great remarks with my thought…



Full speech script: “We are What We Choose” Remarks by Jeff Bezos, as delivered to the Class of 2010 Baccalaureate

本スピーチ日本語訳については次のステキ日本語訳を参照下さい

No Comments

North Shore, Oahu

March 25, 2014

Photos that I took when I visited North Shore of Oafu in Dec, 2013. North Shore is world’s famous surt spot and hosts the world’s premier surfing competitions during winter. My favorite surfing movie, “Soul Surfer” (2011)‘s filming also took place there. I don’t actually surfe but just after spending few hours on beach on the North Shore, I was brought under the spell of North Shore and its perfect waves! I want to go there again!


2013-12-14 07.32.00

Hale’iwa Town Sign that I found when I was driving along Joseph P. Leong Hwy (83).



2013-12-14 09.39.08

Laniakea Beach (“turtle beach”)


2013-12-15 02.03.22

The pool at Turtle Bay Resort overlooks a great surfing spot.


2013-12-15 03.52.12

Beach at the Turtle Bay Resort

No Comments

Queries vs Filter Queries in Lucene/Solr

March 1, 2014

The following testing codes give you exactly the same results. What’s the difference between the two – queries vs filter queries?

Regular Query – TermRangeQuery

TermRangeQuery query = TermRangeQuery.newStringRange(
                    "date", "20100101", "20140228", true, true);
TopDocs topdocs = searcher.search(query, null, 10);

query expression is like this:

q=date:[20100101 TO 20140228]

Filter Query – TermRangeFilter

Query query = new MatchAllDocsQuery();
Filter filter = TermRangeFilter.newStringRange(
                    "date", "20100101", "20140228", true, true);
TopDocs topdocs = searcher.search(query, filter, 10);

query expression is like this:

q= *:*&fq=date:[20100101 TO 20140228]

Queries vs Filter Queries

StackOverflow answers the question (referring links are listed at the “See also” section below). Here is a summary:

  • Filters do not do document scoring while Queries do
  • Filters are cacheable while Queries not. Filters with caching will normally be faster than queries while queries will be faster than filters if filters do not do caching

[note] Caching filters in Lucene-4.6.1:

See Also

No Comments

Separated Indexing Field’s Type in Lucene

February 18, 2014

Before the changes made in LUCENE-2308, LUCENE-3453, Field class instance holds field’s type values such as index or not, store or not, tokenize or not, etc. But after the changes, Field instance no longer hold these field’s type values but FieldType class instance holds them instead. I kind of got used to the old fashioned way like adding each field’s type option directly to Field class instance, and thus it turned out to be a huge change to me. In this post, I get major pre-defined FieldType classes and how to play with FiledType sorted out. Speaking of the change, don’t forget to consult Apache Lucene Migration Guide as well.

Overview of major pre-defined field types

Pre-defined types are very usefull and re-usable for many common cases. Here is an overview of of major pre-defined field types. Please note that each values of either “Yes” or “No” on each columns are fixed and no further change cannot be made, that “(Yes/No)” means that you have an option to choose either “Yes” or “No”, and that empty column means that the value on the column follows FieldType’s default configuration (See “FieldType’s default configuration and setter member functions”).

Field TypeStoredTokenizedIndexedOmit NormVectored
StringField(Yes/No)NoYesYes
TextField(Yes/No)YesYes
IntField(Yes/No)YesYesYes
FloatField(Yes/No)YesYesYes
DoubleField(Yes/No)YesYesYes
LongField(Yes/No)YesYesYes
StoredFieldYes

Indexing Field Details (Column Labels above)

  • Stored: as-is value stored in the Lucene index
  • Tokenized: field is analyzed using the specified Analyzer – the tokens emitted are indexed
  • Indexed: the text (either as-is with keyword fields, or the tokens from tokenized fields) is made searchable (aka inverted)
  • omitNorms: omit normalization values for the field.
  • Vectored: term frequency per document is stored in the index in an easily retrievable fashion. TermVectors are needed for MoreLikeThis

FieldType’s default configuration and setter member functions

TypeDefaultFieldType's Setter member functions
StoredNosetStored(boolean)
TokenizedYessetTokenized(boolean)
IndexedNosetIndexed(boolean)
OmitNormsYessetOmitNorm(boolean)
VectoredNosetStoreTermVectors(boolean)

FieldType’s Case Senarios

1. Simply using Pre-defineed FieldType
If your usage perfectly fits one of the Pre-defined FieldTypes’ configuration, you can simply instantiate them, or you can use either TYPE_STORED or TYPE_NOT_STORED for the field with stored or not stored respectively:

StringField field = new StringField("field name", "field value", true);
//true for stored

or

Field field = new Field("field name", "field value", StringField.TYPE_STORED);

2. Modifying the copy instance of pre-defined FieldType
If pre-defined FieldType is close to what you want but you need to make a few changes, you can copy that type and make changes:

FieldType type = new FieldType(TextField.TYPE_STORED);
type.setOmitNorm(false)
Field field = new Field("field name", "field value", type);

3. Simply using or modifing the instance of FieldType

If your usage fits FiledType’s default configuration(see above), you can simply instantiate FieldType class. Also you can create your own FieldType by using FieldType’s member setters like this:

FieldType type = new FieldType();
type.setStored(true);
type.setIndexed(true);
type.setTokenized(false);
type.setStoreTermVectors(true);
type.setOmitNorms(false);
type.freeze();
Field field = new Field("field name", "field value", type);

See also

No Comments

Patents

February 13, 2014

It looks like that some of patents, which I was involved in for its publishing process, has been granted. Well, what I’ve done for them is just a tiny part but patent is patent, it’s good news anyway!!

See Patents list translated in English
(Original Japanese: http://astamuse.com/ja/patent/granted/person/5972850)

No Comments