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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:01:59+00:00 2026-06-12T17:01:59+00:00

I am trying to use MySQL with Sphinx to provide fulltext searching on usernames

  • 0

I am trying to use MySQL with Sphinx to provide fulltext searching on usernames in order to provide a user search/autocomplete feature.

I have everything set up using the sphinx php api and have managed to get a list of userid’s returned with this code:

include('/usr/local/lib/php/sphinxapi.php');

  $sphinx = new \SphinxClient();
  $mysqlconn = mysql_connect("127.0.0.1:9306") or die ("Couldn't connect to MySQL.");
  $results = $sphinx->Query("John", "users");

  $ids = "";
        foreach($results['matches'] as $id => $data) {
             if($ids > ""){
                     $ids .= ",";
             }
            $ids .= $id;
        }


    echo json_encode($ids);

This returns a comma seperated list of userid’s which have the word ‘John’ in eitheer their firstname or lastname column

Taking this approach I would now need to query the actual mysql database and pull out the users matching those ID’s.

My question is what would be the most efficient way of doing this? Should I use a simple select with an IN() clause or is there a far better way?

Also can Sphinx not return this data for me itself automatically in a more efficient manner?

Thanks in advance

  • 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-06-12T17:02:00+00:00Added an answer on June 12, 2026 at 5:02 pm

    Yup, querying again the mysql database separately is required when using sphinx… You looking up a key in one db and then using it in another DB. No way around it–sort of like using the yellow pages to find a phone number, you still have to dial the number on your phone to speak to the person. There is no way to construct a join across the two DB’s (outside of writing a wrapper library to make it look like it’s doing so).

    However….

    An option you have is to convert your DB over to MariaDB (a drop in replacement for MySQL). As of 5.2.2 they have integration with sphinx as a storage engine: https://kb.askmonty.org/en/about-sphinxse/2941/

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

Sidebar

Related Questions

I am trying to use Sphinx full-text search capability for my MySQL server. I
I'm trying to investigate sphinx rt indexes to use in future project and have
im trying to use MySQL bitwise operations for my query and i have this
I was trying to connect to a Sphinx search server using its MySQL interface.
I have been trying to use the following MySQL: SELECT distinct(photos.id) , photos.file ,
I'm trying to use MySQL and ebeans for saving my tasks. When i apply
I am trying to use MySql Connector 6.2.2.0 for membership and role providers. The
I'm trying to use MySQL (5.5.22, Connector 6.5.4) with Entity Framework 4. I'm using
I'm trying to use a MySQL database to save player information, but whenever there
I'm trying to use the MySQL CASE statements to select products from a products

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.