Virtual Search Columns

1 view
Skip to first unread message

Collin Miller

unread,
Jan 17, 2010, 9:41:31 PM1/17/10
to admin_assistant
I'm trying to create virutal search columns to enable a date-range
search but can't figure out how to configure them.

Here is my search column:

index.search do |search|
search.columns :created_at_before
search.columns :created_at_after
end


I get this error and cant figure out how to set it:

Virtual search column :created_at_before needs a conditions block

Any tips?

Francis Hwang

unread,
Jan 20, 2010, 7:59:25 AM1/20/10
to admin_a...@googlegroups.com
Hi Collin,

What you can do right now is a single search column against created_at:

index.search do |search|
search.columns :created_at
end

... which will then show a created_at search column, with a comparator
widget with possible values like "equal to", "greater than", etc.
However you can't do that more than once against the same column --
i.e. "find me all blog posts created after noon on Monday and before
noon on Thursday". Is that a specific use-case you need to satisfy? If
so, what do you think would be a good way to specify that in your
controller?

Francis Hwang
http://fhwang.net/

> --
> You received this message because you are subscribed to the Google
> Groups "admin_assistant" group.
> To post to this group, send email to admin_a...@googlegroups.com.
> To unsubscribe from this group, send email to admin_assista...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/admin_assistant?hl=en
> .
>
>

Collin Miller

unread,
Jan 26, 2010, 6:08:05 PM1/26/10
to admin_a...@googlegroups.com
Francis,

Yes, my need is to filter one column between two dates.

I've found SearchLogic fulfills this need quite well by having a specifc Search object. http://github.com/binarylogic/searchlogic

For now I've actually found using searchlogic and normal table markup fits my needs, I don't get much slowdown from making my own markup because there are only a small handful of tables.

Yes, my requirement is to filter between two dates for a single column. I'm using Search
--
Collin Miller
(650) 720-5617
Reply all
Reply to author
Forward
0 new messages