我在我的Rails應用程序中思考獅身人面像有嚴重的問題。我的應用程序的規格如下:思考獅身人面像,過濾與協會?
- 的Rails 3.2.6
- 的Ruby 1.9.3
- 獅身人面像2.0.4(r3135)
- 思考獅身人面像2.0.12
在我應用程序我有一個Page
模型和一個Offer
模型和pages
有很多offers
。在Page
模型定義的索引是這樣的:
define_index do
#other indexes defined here
#...
has offers.width, as: :offers_width
has offers.height, as: :offers_height
has offers.price, as: :offers_price
set_property delta: true
end
然後我做的Page
模型,其中pages
是基於搜索查詢和條件來選擇搜索。但是,當我試圖使用:with
篩選器時,Sphinx給了我錯誤的結果。
當我只用一個過濾器,例如price
或width
,結果都OK,但是當我試圖合併過濾器,像price and width
,我得到包含與給定price
OR width
,不提供結果price
和width
。
當我使用範圍搜索時,大多數時間:with
參數是範圍而不僅僅是整數值。使用
編輯1個
查詢IM:
Page.search Riddle.escape(query), conditions: conditions, with: has_cond, star: true, per_page: Page.per_page, page: page
其中has_cond是:
{:offers_height=>[175..200], :offers_width=>[175..200], :offers_price=>[10..80]}
它仍然給我哪裏任何提供具有高度的網頁範圍或任何報價具有該範圍內的寬度或與價格相同的東西。
你能發佈搜索電話嗎? – 2012-07-18 16:24:50
當然,我已經編輯了我的帖子。 – skipi 2012-07-18 20:08:19