0
votes

I'm fairly new to Sunspot and Solr.

I'd like to implement something similar to the Google site: phrase in searches, so that when I search for

something

I get all records related to "something". However, if they search

something site:example.com

It only displays results where the site attribute is example.com.

At the moment I've got:

searchable do
    text :full_text
    text :title, :boost => 5
    text :excerpt
end

Do I need to index the site attribute? How would I implement the above idea?

1

1 Answers

0
votes

No. Just make sure you gsub your params[:query] in your controller. Extract the value next to site: and add a where close to match the site. You'll be left with something.