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 6387567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:10:04+00:00 2026-05-25T03:10:04+00:00

I am using Sphinx to provide search to a website and I’ve run across

  • 0

I am using Sphinx to provide search to a website and I’ve run across a bit of a snag when returning relevant results.

To keep my question simple, let’s assume that I have two fields, @title and @body, which are weighted 100 & 15 respectively. When I search for small words like the word ‘in‘ I would like to have it rank exact matches for that search term higher and then check for matches to ‘in*|*in|*in*‘ and rank them slightly lower. Is there any way to have this type of specificity for your searches?

Example results for ‘in‘:

  1. Indian Food
  2. In The Middle
  3. Document about Latin

Some relevant settings are:

In sphinx.conf:

morphology              = stem_en
charset_type            = utf-8
min_word_len            = 2
min_prefix_len          = 0
min_infix_len           = 2
enable_star             = 1

In search.php

$sp->SetMatchMode( SPH_MATCH_EXTENDED2 );
$sp->SetRankingMode( SPH_RANK_PROXIMITY_BM25 );
$sp->SetFieldWeights ( array('title' => 100, 'body' => 15) );

Also, as a side note: I’ve also had some instances where partial matches don’t even show up in the search results. For example, I have searched for Cow but Cowboy does not show up as a result. I have also searched for Cowb and Cowbo and it wasn’t until I typed Cowboy that I received the expected result. Any thoughts?


This question is along the same lines as this previous SO question, but I hope I’ve given a little more detail as to my problem and the things I’ve tried to warrant a solution.

  • 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-25T03:10:04+00:00Added an answer on May 25, 2026 at 3:10 am

    Looks like morphologically Cow not related to Cowboy.

    You could solve it in two ways:

    1. Use wordforms file with Cow > Cowboy
    2. As star is enabled you could change query from “Cow” to “Cow*” which will find all words starting with “Cow”.

    Regard different ranking for “in” and “in” I could suggest to have two body fields in index, lets say: body and body_star with the same content from body field.

    in search.php

    $sp->SetRankingMode( SPH_RANK_PROXIMITY_BM25 );
    $sp->SetMatchingMode( SPH_MATCH_EXTENDED2 );
    $sp->SetFieldWeights ( array('title' => 20, 'body' => 15, 'body_start' => 5) );
    $sp->Query("@body in @body_star *in* @title in");
    

    This should do the trick.

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

Sidebar

Related Questions

I am using Sphinx Search on a website to keep track of various table
I'm using Sphinx to search MySQL. One of the results Sphinx returns for a
I have a website that is using Sphinx search server to search through a
I am using Sphinx Search . It's working fine for me except one problem:
I'm using Thinking Sphinx for full-text search, following this video . I'd like to
I'm trying to get sphinx search to return excerpts of matched documents. I'm using
I'm thinking about using Sphinx as a search engine for my site. But since
I asked before for a simple solution to my problem (using sphinx search service)
I am using Sphinx with the Thinking Sphinx plugin to search my data. I
I am using sphinx for a site search and it works great but now

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.