*

Nail

  • **
  • 17 posts
Full-text search
« on: June 10, 2021, 01:01:31 PM »
Hi.
I need a full-text search. It mean that I want to search by a part of word. For example in the listings I have word "bicycle". But when I enter "bicyc" in the search field, it found nothing.
Bu if I enter "*bicyc*" then it found it.
How to do full-text search by uncompleted words?
« Last Edit: June 10, 2021, 01:10:23 PM by Nail »

*

MB Themes

Re: Full-text search
« Reply #1 on: June 10, 2021, 01:48:51 PM »
@Nail
You may check this:
https://docs.osclasspoint.com/fine-tuning-mysql-full-text-search-improving-search

Otherwise changes in core may be needed.
In osclass 4.x, you have option for search design selection.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Nail

  • **
  • 17 posts
Re: Full-text search
« Reply #2 on: June 10, 2021, 03:09:03 PM »
1. Link you send me describe only min and max length of searching words. But not uncomplited word searching.
2. Search settings "Title/Description contains pattern" working fine.

Then another question. I have multilingual site - Azeri and Russian.
Listing has title and description in both language. But search work only wetween title and description in selected site language, not inside both language.
How can I make searching inside title and descriptions of all language?

*

MB Themes

Re: Full-text search
« Reply #3 on: June 10, 2021, 03:20:10 PM »
@Nail
You probably cannot do that easily, you might need to change design how search model is created and first search on all listing descriptions & titles, then based on found IDs continue with search.
Or use group by.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Nail

  • **
  • 17 posts
Re: Full-text search
« Reply #4 on: June 10, 2021, 09:05:06 PM »
OK. Are you planning to implement such functionality in the Osclass? The fact is that a user rarely creates an ad at the same time in different languages. He creates ad in Azerbaijani, but in Russian there is no title or description. As a result, this product cannot be found in any way by users who are logged in Russian. Even a search in azeri language won't work.

*

Nail

  • **
  • 17 posts
Re: Full-text search
« Reply #5 on: June 10, 2021, 09:14:30 PM »
for example. My site is secondhand.az There is a listing with title contains "velosipedi" in azeri language, but havent title in russian language. If you change site in AZ language, you can find this listing by typing "velosip", but if you change site to RU languange, you can't find this listing by typing "velosip", although the same title is showed in RU language, because title in RU language was empty.

This is a very useful and necessary functionality. Could you make it in the next update?

*

Nail

  • **
  • 17 posts
Re: Full-text search
« Reply #6 on: Yesterday at 10:13:45 AM »
I found a place with query. This is ajax.php

// GET ITEMS FOR AUTOCOMPLETE VIA AJAX
if(@$_GET['ajaxItem'] == '1' && @$_GET['sPattern'] <> '') {
  $pattern = $_GET['sPattern'];
  $max = 12;

  $db_prefix = DB_TABLE_PREFIX;
  $sql = "
    SELECT i.pk_i_id, d.s_title, i.i_price, i.fk_c_currency_code, CONCAT(r.s_path, r.pk_i_id,'_thumbnail.',r.s_extension) as image_url
    FROM {$db_prefix}t_item i
    INNER JOIN {$db_prefix}t_item_description d
    ON d.fk_i_item_id = i.pk_i_id
    LEFT OUTER JOIN {$db_prefix}t_item_resource r
    ON r.fk_i_item_id = i.pk_i_id AND r.pk_i_id = (
      SELECT rs.pk_i_id
      FROM {$db_prefix}t_item_resource rs
      WHERE i.pk_i_id = rs.fk_i_item_id
      LIMIT 1
    )

    WHERE d.fk_c_locale_code = '" . osc_current_user_locale() . "' AND (s_title LIKE '%" . $pattern . "%' OR s_description LIKE '%" . $pattern . "%') AND b_active = 1 AND b_enabled = 1 AND b_spam = 0
    ORDER BY dt_pub_date DESC
    LIMIT " . $max . ";
  ";

I will change it to get what I need. But I dont want to change the query directly in this file, because if you publish some update, my changes will be removed.
How can I change this query by another way. Child theme, hook or something else? Give me please a little example how to do it to keep them after your updates

*

Nail

  • **
  • 17 posts
Re: Full-text search
« Reply #7 on: Yesterday at 02:02:33 PM »
I think this is not correct place. I have made changes, but nothing happen. Which file needed to be corrected?

*

MB Themes

Re: Full-text search
« Reply #8 on: Yesterday at 08:42:42 PM »
Let me do summary
- it is useful feature for very few people
- told you to search in core, but you searched in theme files
- this change may require complex look to what is being fone and what are consequences
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Nail

  • **
  • 17 posts
Re: Full-text search
« Reply #9 on: Yesterday at 10:00:43 PM »
Ok. Then tell me please where in core is that function to change, and how can I change it and leave it on your updates?

*

Nail

  • **
  • 17 posts
Re: Full-text search
« Reply #10 on: Yesterday at 10:02:42 PM »
Few people? All classified site in our country ( car, real estate and etc) uses this function