Hey i love this module, but for the first time I'm using it on a multilingual site and I don't see any way to prevent french results from appearing in the english search form. Is there something I'm missing or do i need another module to hook into rewrite sql?

thanks

Comments

spelcheck’s picture

+1

awolfey’s picture

I'm open to suggestions on how to do this. Some ideas:

  • Only show nodes from the current language.
  • Let admin set which languages should be shown (All, current, current user's.
  • Let the searcher choose.

Any thoughts?

tmsimont’s picture

I think current language is the way to go, but maybe give the admin an option to expose a language selection.

For my purposed I adjusted the SQL to check a condition for the language column in the node table against the current language

global $language;
$language->language;
polmaresma’s picture

#3
Can you please post the code here?
Thank's!

tmsimont’s picture

i'd put up a patch but i don't know how because i don't git it.

fuzzysearch.module,v 1.16.2.37

I altered that file on line 891-914 to be this:

global $language;

  // Main query
  $sql = "SELECT n.nid, MAX(n.moderate) AS moderate, MAX(n.uid) AS uid, MAX(n.type) AS type, MAX(n.status) AS status, SUM(subpercent) AS percent, SUM(subscore) AS score
          FROM (SELECT DISTINCT word_id, nn.nid, SUM(completeness) AS subpercent, SUM(score) AS subscore
            FROM {fuzzysearch_index} s
            LEFT JOIN {node} nn ON (nn.nid = s.nid)
            WHERE (($clause) AND nn.language='".$language->language."')
            GROUP BY word_id, nn.nid HAVING SUM(completeness) >= %d) AS q
          LEFT JOIN {node} n on n.nid = q.nid
          WHERE n.status = 1
          AND n.type NOT IN ($placeholders)
          GROUP BY n.nid ORDER BY percent DESC, score DESC";

  // Count query
  $sql_count = "SELECT COUNT(DISTINCT(n.nid))
               FROM (SELECT nn.type, nn.uid, nn.moderate, nn.nid, CEILING(SUM(completeness)) AS completeness, SUM(score) AS score
                 FROM {fuzzysearch_index} AS s
                 LEFT JOIN {node} nn on s.nid = nn.nid
                 WHERE $clause AND nn.language='".$language->language."'
                 GROUP BY word_id, s.nid, nn.type, nn.uid, nn.moderate, nn.nid
                 HAVING SUM(completeness) >= %d) AS q
               LEFT JOIN {node} n on n.nid = q.nid
               WHERE n.status = 1
               AND n.type NOT IN ($placeholders)";

mario steinitz’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

I'm currently cleaning up the issue queue.

There is no intention to further supporting the 6.x version of fuzzysearch. So I'll hereby close this issue as outdated.

If you are still using the 6.x version and find this issue critical for your site, please feel free to set it back to active, so that we can look into it and find an according solution.