我想知道是否有任何事情可以帮助改善我用solr看到的搜索结果。使用solr +太阳黑子提高搜索结果
我有一个带有“The Glenlivet 18 year”值的文本字段“name”的产品模型。
我有我的产品型号此搜索块:
searchable do
text :name
end
当我搜索“该格伦利威单一麦芽苏格兰18岁750ML”,我得到的结果为零。
1.9.3-p0 :001 > Product.search { fulltext "The Glenlivet Single Malt Scotch 18 Yr. 750ML"}.results
=> []
这似乎是我必须真正煮沸搜索查询才能得到一个结果,这不是很有用。
1.9.3-p0 :002 > Product.search { fulltext "The Glenlivet 18 Yr. 750ML"}.results
=> []
1.9.3-p0 :006 > Product.search { fulltext "The Glenlivet Single Malt 18"}.results
=> []
它真的像这样的接缝工作。
1.9.3-p0 :003 > Product.search { fulltext "The Glenlivet 18 Yr."}.results
=> []
后来终于
1.9.3-p0 :007 > Product.search { fulltext "Glenlivet 18"}.results
Product Load (0.2ms) SELECT `products`.* FROM `products` WHERE `products`.`id` IN (8)
=> [#<Product id: 8, name: "The Glenlivet 18 year"]
它在该sunspot_solr宝石创建Solr的所有默认设置。下面是我的配置文件:
有了这些样的结果它几乎击败了全文搜索的目的。有没有我可以调整的设置或我可以做的其他事情,以便这些结果看起来并不严格?
编辑:
添加:minimum_match => 4
并设置同义词似乎提供我想要的结果。
Product.search { fulltext "The Glenlivet Single Malt Scotch 18 Yr. 750ML", :minimum_match => 4}.results
你可以从'schema.xml'发布全文字段的定义和fieldType吗? – javanna 2012-02-20 11:49:47
我添加了我的schema.xml http://pastebin.com/53ryHT6H – AdamB 2012-02-20 20:18:57