I have some fields that are only used for faceting, so
they're only
queried by facet results. No modification is needed, no
lowercase,
nothing. So the KeywordTokenizerFactory seems to be perfect
for them.
You can use plain string type definition (comes in schema.xml) for that purpose.
Alas, when the value contains spaces, I'm still getting too
many
results. I have a field defined like this:
<fieldType name="text_unchanged"
class="solr.StrField"
positionIncrementGap="100">
<analyzer>
<tokenizer
class="solr.KeywordTokenizerFactory"/>
</analyzer>
</fieldType>
(Using solr.TextField didn't change anything)
When quering for:
....&fq=label:Aces+of+London
I get the result:
.... "facet_fields":{
"label":[
"Aces of London",31,
"Feud London",2,
"Fly London",2],
....},
I get the same result when taking "Feud London" as the
facet value.
When inspecting the index with the schema browser, I can
see that all
labels are tokenized correctly in complete, i.e. there's no
token
"London", but a token "Aces of London". So the
KeywordTokenizer seems to
work as expected, at least for indexing. It's only that the
facet query
is not narrow enough.
Even the superb Solr book didn't help me here. Does anybody
have a clue
what I'm doing wrong here?
try using Parenthesis with queries that contain more than one term. &fq=label:(Aces+of+London)
Otherwise <defaultSearchField></defaultSearchField> jumps in.