Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

Commit

Permalink
Clarify text vs string and set default field type to text
Browse files Browse the repository at this point in the history
  • Loading branch information
rnewson committed Aug 23, 2016
1 parent b387310 commit 5106b03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ The following indexing options can be defaulted;
<th>type</th>
<td>the type of the field</td>
<td>date, double, float, int, long, string, text</td>
<td>string</td>
<td>text</td>
</tr>
<tr>
<th>store</th>
Expand All @@ -176,6 +176,10 @@ The following indexing options can be defaulted;
</tr>
</table>

<h3>String vs Text</h3>

There are two supported types that sound equivalent, <em>string</em> and <em>text</em>, but they are very different. A text field will be tokenized into words and is usually what you expect from a full-text index. A string field is not tokenized, only exact matching will work. The advantage to string fields is that they have a meaningful sort order.

<h3>The Analyzer Option</h3>

Lucene has numerous ways of converting free-form text into tokens, these classes are called Analyzer's. By default, the StandardAnalyzer is used which lower-cases all text, drops common English words ("the", "and", and so on), among other things. This processing might not always suit you, so you can choose from several others by setting the "analyzer" field to one of the following values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public final class ViewSettings {

public static ViewSettings getDefaultSettings() {
return new ViewSettings(Constants.DEFAULT_FIELD, "no", "string", "1.0", null);
return new ViewSettings(Constants.DEFAULT_FIELD, "no", "text", "1.0", null);
}

private final Store store;
Expand Down

0 comments on commit 5106b03

Please sign in to comment.