Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
8 Feb 2012 at 21:25 UTC
Updated:
5 Jun 2014 at 08:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
nick_vhThis is expected behavior because text processing takes a very long time and this would not be optimal for most of the installs
An easy code snippet solves this for your site :
Comment #2
nick_vhComment #3
becw commentedI think that makes sense for fields of type
text_long fieldsandtext_with_summary, which if they are stored should definitely use'index_type' => 'text', but thetextfield type is 255 characters or less, and storing it as 'string' means that Apache Solr does not do any processing of the values.Anyway, thanks for explaining the reasoning! Implementing
hook_apachesolr_field_mappings_alter()does solve my problem :)Comment #4
becw commentedIs there a way to index a single Drupal field two different ways in Solr? For example, as type 'text' for fulltext search in a single field, and as type 'string' for facets and sorting?
Comment #5
darren ohIt makes no sense to not have mapping for basic text fields. Keeping it out means unnecessary complexity and duplication of effort.
Comment #6
twigley commentedI'm having some problems with the fix Darren Oh has provided above.
Adding these changes did mean the text fields are indexed (I can see them in the search index report, listed with index type "string").
However, they don't appear as Facets within the facet settings.
Do I need to do anything else to make them appear as facets other than set facets to true as above?
Any help would be really appreciated.
Comment #7
twigley commentedAll fixed. It's a very large data-set, they came through automatically after a couple of minutes.
Comment #8
nick_vhText fields should not be mapped and certainly not be used for facets. The reason for this is due to the inner workings of solr. You should map the fields as if they were strings, not text.
Strings (ss_*)
Literal representations of values, for example balloons=balloons
text (ts_*)
Parsed representations of values that go through analyzers. eg. (query) balloons = balloon.
If you map them, map them to strings, and if you want text analysis, be sure to know the implications before you map them to text fields. But, if we do this automatically, such as the patch implies, we risk getting massive strings. You surely don't want a text blob of 300+ characters to be a literal string that you facet on?
I think we need to find a more pragmatic solution here instead of mapping all text fields as strings.
Comment #9
darren ohMy patch only affects the text field type, which is limited to 255 characters. It makes it possible to index the text field type, but does not automatically do so. People will still need to enable indexing for the specific fields they wish to use as facets. It is reasonable to expect that people will index specific fields because they really want to.
Comment #10
jordiserra commentedJust FYI,
Search API allows you to index text fields by default, and facets work like a charm. Fulltext fields does not work, but this is coherent with this post.
Comment #11
nick_vhAfter much thinking this actually makes sense and if we can restrict it to that small text field setting it seems like a reasonable feature request and as such I will add it to the dev version.
Comment #12
nick_vhWe should port this to 6.x-3.x. Committed for 7.x-1.x
Comment #13
mkalkbrennerFrom my point of view that's already implemented in 6.x-3.x in combination with content.module:
But in opposite to 7.x-1.x the text is not handled by apachesolr_clean_text(). I attached a patch to do that.
Comment #15
mkalkbrenner