SOLR is equipped with a word breaker, but the word breaker has a filter with uppercase converted to lowercase, and the number is filtered. Like 123 Chinese ABC. 123 will be filtered out, so only check 1|12|123 will fail.
"SOLR numeric characters can not search for a problem" this blog post is more detailed, I am studying this article.
According to the account to search, when the account in the database is an integer variable, import into SOLR, configure a single number of filter field, is not the search for any information, for some reason, there is time to study schema.xml this configuration file first.
In schema.xml This configuration file, add the field type:
<fieldtype name= "Text_inclunum" class= "SOLR. TextField "positionincrementgap=" ><analyzer type= "index" ><tokenizer class= "SOLR. Whitespacetokenizerfactory "/><filter class=" SOLR. Edgengramfilterfactory "mingramsize=" 1 "maxgramsize=" "side=" front "/></analyzer><analyzer type=" Query "><tokenizer class=" SOLR. Whitespacetokenizerfactory "/><filter class=" SOLR. Edgengramfilterfactory "mingramsize=" 1 "maxgramsize=" side= "front"/></analyzer></fieldtype>
"SOLR. Edgengramfilterfactory "mingramsize=" 1 "maxgramsize=" 50 "This is a word from left to right.
Let's use this field type for our fields:
In the analysis to do a bit of analysis, see can cut:
No problem! Then search inside the search:
No problem, the most qualified in the front, followed by the second row in the back.
The rest of the matter is simple, follow the previous tutorial, change the configuration parameters, enter two characters to trigger:
The result of the final rendering is:
The front is the most consistent:
SOLR Advanced Nine: SOLR searches for numbers and single characters