I have 2 tables : Company and category (category table has tags field, I wrote keywords for each category, I used comma(,) as delimiter)
When I search something, it will first search in the company table and then search the query in the tags field.
I wrote the query but I have a problem. When I search "emlak", everything is fine but if I search "emlakçı" it can't find anything. Do I have to enter "emlakçı" as a keyword in tags field or is it possible to solve this with an another way?
Here is my query :
SELECT
SQL_CALC_FOUND_ROWS company.*,
MATCH(company.c_title) AGAINST('SEARCH TEXT') as nameScore,
MATCH(category.tags) AGAINST('SEARCH TEXT') as tagScore
FROM company LEFT JOIN category ON company.c_cat_id = category.c_id
WHERE MATCH(company.c_title) AGAINST('SEARCH TEXT')
OR MATCH(category.tags) AGAINST('SEARCH TEXT')
ORDER BY nameScore DESC
Best Answer
Here is your original query
You may want to try running the fulltext searching before doing the LEFT JOIN
As for the search string
emlakçı
, try using a wildcard character. In other words,This may pick up more occurrences but should get emlak and similar strings
UPDATE 2012-07-30 18:01 EDT
I don't know your table structure. Assuming
name
is a field in category, try this: