Search returns no results for specific key word

Kiril Mitov's Avatar

Kiril Mitov

25 Sep, 2018 07:10 AM

Hi,

This is the site.
https://www.fllcasts.com

It has materials which has title and description. The title and descriptions are indexed. Sometimes when I search for specific words from the titles it does not return results.

Example when working - https://www.fllcasts.com/search?utf8=%E2%9C%93&search=box
Example when not working - https://www.fllcasts.com/search?utf8=%E2%9C%93&search=camel

I would expect for the second case to see https://www.fllcasts.com/materials/416-camel-build-from-lego-ev3-mindstorms
It has 'Camel' in the title. Even if I search for the whole "Camel built from LEGO EV3 Mindstorms"

This means that some results are returned and others are not. And this is on the model level. So I've also debugged it and the call

  def search query, page, per_page, classes = []
    query = Riddle::Query.escape(query)

    ThinkingSphinx.search(query,
                          classes: classes,
                          sql:{include: [:translations, :content_pictures]},
                          :without => @without,
                          :field_weights => CAST_CONFIG["episode_search"]["field_weights"],
                          :page=>page,
                          :per_page=>per_page)
  end
does not return results for a search of "camel".

What else should I check. Where could this problem be coming from ?

Best Regards,
Kiril

  1. Support Staff 1 Posted by Pat Allan on 25 Sep, 2018 10:58 AM

    Pat Allan's Avatar

    Hmm, I'm not spotting anything obviously wrong - it certainly sounds like the behaviour you're hoping for should work!

    In that search call, what are the values of classes, @without, and CAST_CONFIG["episode_search"]["field_weights"]?

  2. 2 Posted by Kiril Mitov on 25 Sep, 2018 11:13 AM

    Kiril Mitov's Avatar

    The values are
    classes = [Episode,Course,Material, Program], these are active records
    @without - these are the ids of the not published object. An yes, Camel is
    a published object. There is a field in the records called published_at
    that I compare with current date and the unpublished and not shown
    CAST_CONFIG["episode_search"]["field_weights"] is:
    episode_search:
     field_weights:
      position: 50
      name: 20
      categories_names: 20
      description: 15
      long_description: 15
      tag_names: 15
      subtitles_html_content: 5
      materials: 5

    Best Regards,
    Kiril

  3. Support Staff 3 Posted by Pat Allan on 25 Sep, 2018 02:32 PM

    Pat Allan's Avatar

    The record's definitely there in Sphinx. I'm not yet sure why it's not appearing though… I would recommend you debug by starting with a basic search in your Rails console and then add in each of the options one by one to see how that influences results. For example:

    Material.search "Camel"
    # then
    ThinkingSphinx.search "Camel",
      :classes => [Episode, Course, Material, Program]
    # then
    ThinkingSphinx.search "Camel",
      :classes => [Episode, Course, Material, Program]
      :sql => {include: [:translations, :content_pictures]}
    
  4. 4 Posted by Kiril Mitov on 01 Oct, 2018 06:21 AM

    Kiril Mitov's Avatar

    I did this. Nothing. It returns an empty result.

    What else could I do?

    Best Regards,
    Kiril

  5. Support Staff 5 Posted by Pat Allan on 01 Oct, 2018 09:15 PM

    Pat Allan's Avatar

    Does the simplest version of that (Material.search "Camel") not work for you? I'm seeing the record in Sphinx, so I'm rather surprised if it doesn't get returned!

    I am presuming it's the app named fllcasts - is this correct?

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac