查询:mpn:"MEM-CF-512MB-AOK"
索尔回应:
{
"responseHeader": {
"status": 0,
"QTime": 1,
"params": {
"fl": "id, mpn, name",
"indent": "true",
"q": "mpn:\"MEM-CF-512MB-AOK\"",
"_": "1375801439480",
"wt": "json"
}
},
"response": {
"numFound": 2,
"start": 0,
"docs": [
{
"id": "1340120",
"mpn": "MEM-CF-256MB-AOK",
"name": "256MB CompactFlash"
},
{
"id": "1340129",
"mpn": "MEM-CF-512MB-AOK",
"name": "512MB CompactFlash"
}
]
},
"spellcheck": {
"suggestions": [
"correctlySpelled",
true
]
}
}
预期的:
{
"id": "1340129",
"mpn": "MEM-CF-512MB-AOK",
"name": "512MB CompactFlash"
}
我需要搜索:
1)MEM-CF-512MB-AOK
2)MEM-CF-512MB
3)MEM-CF-512MB-AO
4)M-CF-512MB-AOK
5) -CF-512MB-AOK
架构.xml:
<field name="mpn" type="text_general_edge_ngram" indexed="true" stored="true"/>
<fieldType name="text_general_edge_ngram" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.LowerCaseTokenizerFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="50" side="front"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.LowerCaseTokenizerFactory"/>
</analyzer>
</fieldType>