'Use termfreq(field,term) function for phrase with space in SOLR 4.1
I am using termfreq(field,term) SOLR function. This works:
?fl=product_name,termfreq(product_name,"iphon")&q=iphone 4s //Found freq
But the problem is to have term like "iphone 4s" with space
?fl=product_name,termfreq(product_name,"iphon 4s")&q=iphone 4s //Return 0 freq
Return 0 freq although that term(phrase) exist in doc. So, the question is, can I use termfreq() function with full phrase like "iphone 4s", And how?
I am using SOLR 4.1. and analyzer for field is
<fieldType name="text_ws" class="solr.TextField">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
Field is
<field name="product_name" type="text_ws" indexed="true" stored="true"/>
Solution 1:[1]
As you are using a WhitespaceTokenizerFactory the term iphone 4s would not exist as a term.
You could use KeywordTokenizerFactory for indexing, which doesn't tokenize the words and the phrase should be available.
Else you can check for shingle options which would group words for you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jayendra |
