Sphinx treatment "s" and "no"



  • Colleagues, please tell me, someone has solved the problem of a search-and-extradition problem, whose name is part of the request, but with a "no."

    Example "dry cabin without a bath."

    Response

    Душевая кабина Appollo с баней
    Душевая кабина Eago
    Душевой бокс Niagara без бани
    

    It's the same story looking for a bowl with a bath.

    The rest of the search results are valid and entirely satisfactory! That's why you don't want to change algorithms, interested in other people's experiences.



  • I'd solve this problem with weight setting. I mean, if there's words like "s," "no" on the request, give them maximum weight.

    // after sphinx initialize
    $searchTerms = (isset($_GET['search']) && !empty($_GET['search']))? $_GET['search'] : null;
    $words = explode(' ', $searchTerms);
    foreach($words => $word) {
    if (in_array($word, $strongWords) {
         $weights['name'] = 9999;
         sphinx->setFieldWeights($weights);
    }
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2