Tron
Tron

Reputation: 703

Fusion Tables filter conditions OR

According to https://developers.google.com/fusiontables/docs/developers_reference OR operations are not allowed as part of filter conditions. So I'm trying to come up with a creative way to solve the following:

I have a fusion table backed google map with hundreds of places and want to filter it to only places that have 'tags' or a 'title' containing a search parameter.

Ideally I could just use the following as my filter condition:

tags CONTAINS IGNORING CASE 'searchterm' OR title CONTAINS IGNORING CASE 'searchterm'

But the fusion table API simply doesn't allow it. So what to do? Make 2 separate queries, then filter out the duplicates? That means I can't use the nice FusionTablesLayer pre-rendered tile functionality.

What would you do?

Upvotes: 5

Views: 1926

Answers (2)

javram
javram

Reputation: 2645

How about adding a column to your table called "Show_In_Results",

then running two separate queries to update that column for each row of data based on whether the search term is found in the specific column or not.

UPDATE 'table_id'
SET Show_In_Results = 1

UPDATE 'table_id'
SET Show_In_Results = 1
WHERE tags CONTAINS IGNORING CASE 'searchterm' 

UPDATE 'table_id'
SET Show_In_Results = 1
WHERE title CONTAINS IGNORING CASE 'searchterm' and Show_In_Results <> 1

Then when you render your map layer:

SELECT 'columns' FROM 'table_id' WHERE Show_In_Results = 1

Upvotes: 2

Tron
Tron

Reputation: 703

A possible answer is to pre-render the data within the table. Essentially add another column which is an aggregate of tags and title. Then I only need to query the one 'tags_or_titles' column. Of course this means more data munging beforehand when I export the data into the fusion table and doesn't feel so nice and clean...

Upvotes: 3

Related Questions