私はZend_Search_Lucene
を活用したいデータベースがあります。しかし、私はLuceneのための "完全に検索可能な"ドキュメントを作成するのが難しいです。zend検索lucene
各Zend_Search_Lucene
文書は、2つのリレーショナルデータベーステーブル(Table_One
およびTable_Two
)から情報を取得します。 (Table_One
の各エントリについて、Table_Two
内の1つの以上のエントリがあるかもしれない、の意味)Table_One
にNの関係:Table_One
はTable_Two
1を有し、(id
、owner_id
、title
、description
、location
など)基本的な情報を有しています。 Table_Twoには、ID、listing_id
、bedrooms
、bathrooms
、price_min
、price_max
、date_available
が含まれています。 1
Table_One
id (Primary Key)
owner_id
title
description
location
etc...
Table_Two
id (Primary Key)
listing_id (Foreign Key to Table_One)
bedrooms (int)
bathrooms (int)
price_min (int)
price_max (int)
date_available (datetime)
問題は、各Table_One
エントリの複数Table_Two
エントリがある図1
図を参照してください。 [質問1]各フィールドが一意であるZend_Search_Lucene
文書を作成するにはどうすればよいですか?
図2
Lucene Document
id:Keyword
owner_id:Keyword
title:UnStored
description:UnStored
location: UnStored
date_registered:Keyword
... (other Table_One information)
bedrooms: UnStored
bathrooms: UnStored
price_min: UnStored
price_max: UnStored
date_available: Keyword
bedrooms_1: <- Would prefer not to have do this as this makes the bedrooms harder to search.
次(図2を参照)、私はbedrooms
、bathrooms
、price_min
とprice_max
フィールドに範囲クエリを行うことができるようにする必要があります。 (例:1ベッドルームと3ベッドルームの間にあるドキュメントを見つける)Zend_Search_Lucene
は、同じフィールドでの遠隔検索のみを許可します。私の理解から、これは、私がレンジクエリをしたいそれぞれのフィールドには1つの値しか含めることができないことを意味します(例:ベッドルーム: "1ベッドルーム")。
私が今持っている何を、Luceneのドキュメント内で区切られた空間であることbedrooms
、bathrooms
、price_min
、price_max
、date_available
分野です。
例:
Sample Table_One Entry:
| 5 | 2 | "Sample Title" | "Sample Description" | "Sample Location" | 2008-01-12
Sample Table_Two Entries:
| 10 | 5 | 3 | 1 | 900 | 1000 | 2009-10-01
| 11 | 5 | 2 | 1 | 800 | 850 | 2009-08-11
| 12 | 5 | 1 | 1 | 650 | 650 | 2009-09-15
サンプルLuceneのドキュメント
id:5
owner_id:2
title: "Sample Title"
description: "Sample Description"
location: "Sample Location"
date_registered: [datetime stamp YYYY-MM-DD]
bedrooms: "3 bedroom 2 bedroom 1 bedroom"
bathrooms: "1 bathroom 1 bathroom 1 bathroom"
price_min: "900 800 650"
price_max: "1000 850 650"
date_available: "2009-10-01 2009-08-11 2009-09-15"
[質問2]あなたはbedroom
の範囲クエリー検索を行うことができ、bathroom
、price_min
、price_max
、date_available
フィールドそれらが示す通りであります各レンジクエリフィールドは1つの値(「1ベッドルーム」など)のみを含む必要がありますか?私はRange Queryを現在のフォームで動作させることができませんでした。私はここで負けている。
ありがとうございます。
おかげで数値フィールドは次のようなものでなければなりません。それはまさに私がやったことです。ありがとうございます。 –