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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:22:44+00:00 2026-06-07T20:22:44+00:00

I need to create phrase search using sphinx. I created my index using this

  • 0

I need to create phrase search using sphinx. I created my index using this config file

source sphinx_search
{
    type                                    = mysql
    # some straightforward parameters for SQL source types
    sql_host                                = localhost
    sql_user                                = root
    sql_pass                                = root
    sql_db                                  = mydatabase
    sql_port                                = 3306

    sql_query                       = \
        SELECT userId, usertype_id, searchdata from tbl_user;

    #sql_attr_uint                       = userId
    sql_attr_uint                       = usertype_id

     #document info query, ONLY for CLI search (ie. testing and debugging)
     #optional, default is empty
     #must contain $id macro and must fetch the document by that id
    sql_query_info      = SELECT * FROM tbl_user WHERE userId=$id;

}
index sphinx_search {
    source                          = sphinx_search
    path                            = /var/lib/sphinx/sphinx_search
    morphology                      = stem_en
    min_stemming_len        = 4
    stopwords                       = /var/data/sphinx/stopwords.txt
    min_word_len            = 3
    min_prefix_len          = 3
    min_infix_len           = 0
    enable_star                     = 1
    phrase_boundary = ., ?, !, U+2026 # horizontal ellipsis
    phrase_boundary_step = 100
    html_strip = 1

} 

indexer {
    mem_limit = 256M    
   #mem_limit       = 128M
    max_xmlpipe2_field = 16M 
}


searchd {   
    compat_sphinxql_magics  = 0     
    listen          = 9312  
    listen          = 9306:mysql41  
    log         = /var/log/sphinx/searchd.log   
    query_log       = /var/log/sphinx/query.log     
    read_timeout        = 5     
    max_children        = 30    
    pid_file        = /var/run/sphinx/searchd.pid   
    max_matches     = 10000     
    seamless_rotate     = 1     
    preopen_indexes     = 1     
    unlink_old      = 1     
    workers     = threads # for RT to work  
    binlog_path     = /var/data/ 
}

If I tried to search for “Water Pollution” word

The search result is showing like this

words:
1. 'water': 10554 documents, 37143 hits
2. 'pollut': 1902 documents, 9657 hits

First issue is its not taking that “pollution” word completely Instead of that its taking “pollut”.

Second problem is its not searching for that complete word. Even if I search

“water pollution”
like this.

third problem I am unable to sort my result with userId. If I tried to add

sql_attr_uint = userId

its not indexing properly.

Any body can help me to fix these issues. Please help me.

  • 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-07T20:22:46+00:00Added an answer on June 7, 2026 at 8:22 pm

    In a nutshell you have to set extended match mode and use extended query syntax:

    $cl->SetMatchMode ( SPH_MATCH_EXTENDED );
    $cl->Query ( '"Water pollution"' );
    

    Notice double quotes around search term.

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

Sidebar

Related Questions

I have dynamically created WrapPanel (_wp) with several Borders. And I need create handler
Need to create a custom DNS name server using C which will check against
This is quite difficult to phrase, but I need to be able to link
I need to make this jquery run much faster, I did not create all
I want to create simple application that detects language(using Google API) of phrase and
I'm using Xcode 4.3 to create a framework for OS X. I created a
I need create custom dialog and put JPanel into it. Is it possible?
i need create an email list sending to many emails. what is best solution
I need create clone repository. but I do not know where can I get
I need create a document word with Java. And I ask, how can I

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.