Ikon
Ikon

Reputation: 155

Sphinx SPH_MATCH_ALL,SPH_MATCH_PHRASE,SPH_MATCH_BOOLEAN,SPH_MATCH_ALL and SPH_MATCH_EXTENDED2?

I am new to Sphinx Search. How to use this Matching modes in PHP?

Example:

   SPH_MATCH_ALL,SPH_MATCH_PHRASE,SPH_MATCH_BOOLEAN,SPH_MATCH_ALL and SPH_MATCH_EXTENDED2?

   <?php
 include('sphinxapi.php');
        $cl = new SphinxClient();
        $cl->SetServer('localhost',9312);
            $cl->SetMatchMode(SPH_MATCH_ANY);
        //$cl->SetMatchMode(SPH_MATCH_EXTENDED2);
        //$cl->SetMatchMode(SPH_MATCH_ALL);
        //$cl->SetMatchMode(SPH_MATCH_PHRASE);
        $cl->SetArrayResult(true);
        $cl->SetLimits(0, 100); 
        $result = $cl->Query("&name Bormis","abc_index");

        echo "<pre>";
        print_r($result);
        exit;
     ?>

In this code here working only SPH_MATCH_ANY.

But, I need with search exist word match.and

How to use all the Matchind modes in this example?

Upvotes: 2

Views: 5835

Answers (1)

pleasedontbelong
pleasedontbelong

Reputation: 20102

first choose you matching mode, they all work in different ways. Depending on your application, you'll make your choice.

Sphinx uses some query operators like & (and), | (or), etc. so if you send a query like "&name Bormis", sphinx might not understand it.

Try using only "Bormis" as a query too see the difference between the matching modes. If you prefer it, you could also do the search in the command line to test if your configuration is correct.

Good Luck!

Upvotes: 1

Related Questions