Unless you have any sort of weird overlap between your text field
names, you should be able to just do a single search:
Sunspot.search(Model1, Model2) do
fulltext('blah')
end
Mat
> --
> You received this message because you are subscribed to the Google Groups
> "Sunspot" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/ruby-sunspot/-/v2H8OBPSnvMJ.
> To post to this group, send email to ruby-s...@googlegroups.com.
> To unsubscribe from this group, send email to
> ruby-sunspot...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ruby-sunspot?hl=en.
Hi Mat,The use case is a bit tricky.Users can enter in stuff like this:composer:mozart [c20]This means items where the composer is mozart and the c20 means duration circa 20 minutes.This get converted to:keywords('mozart', :fields => [:composer])with(:duration, 1080..1320)which is evaledIn acts as solr we used to just send through the field:value parts of the string untouched.I am using this rather than drop downs on an advanced screen is that this is much, much faster for our types of searches (most fields actually have aliases, so cp:mozart for the above for example).The reasons why this is needed is the users are searching over multiple data sources (some that are nothing to do with music) , and we cannot query by every specified field in some of the data. Compiling the search block against what fields are indexed avoids a search error (we just don't quert those tables).Basically, if the query string is just text we return results from all data sources. If people enter some fields (or durations) then the system is smart and Does The Right Thing by excluding data sources that do not have those fields.Results are returned in tabs rather than on one screen (which does not make sense in our context), which is why we query one table at a time.(If you want to see an explanation of the pre-rails version of the app looks like it was covered in Linux Journal: http://www.linuxjournal.com/article/7774)A side question: what is the correct datetime format that I can use with .less_than and .greater_than if I cannot pass in a Time object?Richard
On Thursday, March 1, 2012 12:13:38 PM UTC+13, outoftime wrote: --
You received this message because you are subscribed to the Google Groups "Sunspot" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ruby-sunspot/-/TW3uieyUMCwJ.
To post to this group, send email to ruby-s...@googlegroups.com.
To unsubscribe from this group, send email to ruby-sunspot...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ruby-sunspot?hl=en.
Hi Richard,
Unless you have any sort of weird overlap between your text field
names, you should be able to just do a single search:
Sunspot.search(Model1, Model2) do
fulltext('blah')
end
Mat
I have a app that is searching many (searchable) tables.Each table has different text fields. User are able to search across all of them in one go - I compile a block for each table and execute it separately.The compiled block (of scopes) is EVALed inside the Sunspot.search block.The reason I do this is so that a field search:eg. composer:mozartis assembled only for the tables that have the composer field indexed.Is there a better way to inject scopes into a search?--
You received this message because you are subscribed to the Google Groups "Sunspot" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ruby-sunspot/-/v2H8OBPSnvMJ.
To post to this group, send email to ruby-s...@googlegroups.com.
To unsubscribe from this group, send email to ruby-sunspot...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ruby-sunspot?hl=en.
So, back to your questions, would you please explain more?
--
You received this message because you are subscribed to the Google
Groups "Sunspot" group.
To view this discussion on the web visit
> --
> You received this message because you are subscribed to the Google Groups
> "Sunspot" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/ruby-sunspot/-/FfZqnvBBafAJ.