Difference between Sunspot rails: text an: string fields

As everyone knows in your searchable model, you can define an index of type: text and also: string, for example:

class Post < ActiveRecord::Base searchable do string :title text :title, :body end 

I tried to find the main differences between the type of the text field and the type of the string field and was able to get a basic understanding, for example:

  • Types of text fields are tokenized, which makes finding text in the text very fast.
  • You cannot use order_by ie to sort in a text file, and if you need sorting in this field, you need to define it as: string.

So, I am looking here for all the CONCEPTUAL , as well as USING the differences between the type of the text field and the type of the field field, so that I can weigh my opinions while defining the field as a string, text, or both.

Note: I am not saying that you provide all the differences in one answer, and one difference for the answer will also be made, but please make sure that the difference you give is not already indicated.

+7
ruby-on-rails solr sunspot
source share
1 answer

Text fields

When text fields are indexed, they are broken down into their compound words, and then processed using a specific set of filters (with Solr set to default Sunspots by default, they are only with a lower location). This process is known as tokenization, and it also allows you to search for text fields using full-text matching. You can learn more about tokenization and the available filter options in the Solr wiki file http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters .

String fields

String fields store string data. How is this different from text fields? The text field is symbolized, which means its splitting into its compound words; this is how full-text search works. String fields, on the other hand, are simply indexed as they are: indexed data is this string, from start to finish.

Docs

https://github.com/sunspot/sunspot/wiki/Setting-up-classes-for-search-and-indexing

+14
source share

All Articles