Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7622521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:28:32+00:00 2026-05-31T04:28:32+00:00

In the Photo model I have following simple rule: searchable do string :note end

  • 0

In the Photo model I have following simple rule:

  searchable do
    string :note
  end

and I try to search some string with Solr (simultaneously in two tables). This is the output of Solr query in the terminal (the first one for Articles, the second one for Photos):

SOLR Request (4.8ms) [ path=# parameters={data: fq=type%3A
Article&q=searched_string&fl=%2A+score&qf=title+content&defType=dismax&start=0&rows=30 , method: post, params: {:wt=>:ruby}, query: wt=ruby, headers:
{“Content-Type”=>”application/x-www-form-urlencoded; charset=UTF-8”},
path: select, uri: http://localhost:8982/solr/select?wt=ruby,
open_timeout: , read_timeout: } ]

and this

SOLR Request (4.4ms) [ path=#
parameters={data: fq=type%3A
Photo&q=asgasg&fl=%2A+score&defType=dismax&start=0&rows=30 , method: post, params: {:wt=>:ruby}, query: wt=ruby, headers:
{“Content-Type”=>”application/x-www-form-urlencoded; charset=UTF-8”},
path: select, uri: http://localhost:8982/solr/select?wt=ruby,
open_timeout: , read_timeout: } ]

controller:

@articles = Article.search do
  fulltext params[:search]
end
@photos = Photo.search do
  fulltext params[:search]
end
## => searching ##
puts @articles.results #work fine
puts @photos.results #always 0

I totally don’t know, why SOLR doesn’t search in the Photo model… everything should be specified and set up, but still don’t know, where is the problem…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:28:34+00:00Added an answer on May 31, 2026 at 4:28 am

    I think in Photo model you have to define :note as text type (not string) in order to run fulltext search on it:

    searchable do
      text :note
    end
    

    Also, you set @articles and @photos, but checking @users and @photos in your question.

    UPDATE

    According to sunspot readme:

    “text fields will be full-text searchable. Other fields (e.g., integer and string) can be used to scope queries”

    That is, to run fulltext or keywords on that field, it has to be declared as text in the searchable block. You have it as string, which can only be used for exact match using with().

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Photo model with the following method to search for associated tags
So, I have the following scope in my Photo model: scope :best, order(:average_rating.desc) The
I have following models class Artist(models.Model): name = models.CharField(max_length=200, unique=True) photo = models.CharField(max_length=250) views
I have the following code on my model: has_attached_file :photo, :styles => { :small
I have the following query method in my ActiveRecord model: def self.tagged_with( string )
I have a simple photo taking application that has the following design: [Consider the
Let's say I have the following models class Photo(models.Model): tags = models.ManyToManyField(Tag) class Tag(models.Model):
I have the following in models.py: class Choices(models.Model): description = models.CharField(max_length=300) def __unicode__(self): return
I have the following structure: class FeatureType(models.Model): type = models.CharField(max_length=20) def __unicode__(self): return self.type
I currently have a simple model defined, with a photoupload feature using django thumbnails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.