i want to search only the model data for the current city—think stores
and products, store has a city field, products belong to stores.
does acts_as_ferret or anything similar have a way to index a subset of
a table or how would you handle this? best i can think of is using
ferret manually to create an index for each city, but it seems like it’d
come up often enough that someone has put together something slicker?
are there any examples you’ve seen anywhere of implementing this type of
indexing in a rails app?
thanks!
what i wound up doing is:
-
creating a product_cities method that runs a select distinct at the
database and dumps a space-delimited list of the city ids where that
product is found
-
adding a +product_cities: term to every query for a
product in the context of a city
-
reindexing the product object after any new association is made
between it and a store as this may change the city list
still kinda ick, but serviceable.
Harm Less wrote:
i want to search only the model data for the current city—think stores
and products, store has a city field, products belong to stores.
does acts_as_ferret or anything similar have a way to index a subset of
a table or how would you handle this? best i can think of is using
ferret manually to create an index for each city, but it seems like it’d
come up often enough that someone has put together something slicker?
are there any examples you’ve seen anywhere of implementing this type of
indexing in a rails app?
thanks!