Advertisement:

Author Topic: Custom field search  (Read 5442 times)

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Custom field search
« Reply #75 on: March 11, 2019, 10:24:58 am »
You said you wanted to add the custom fields into the description. This is the way to do it. Make 2 functions to add and remove them from description. This is a model.

Yes i want to add custom-fields into title and description by hook in functions.php
But in that link they are talking about minimum word len!

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom field search
« Reply #76 on: March 11, 2019, 06:08:58 pm »
It does not mater. the purpose is the same. That is a hack to leave the ft_min_word_len as it is (4 for example) but to enable the user to search by min 1 character. If you read there it is written.

Leave the title out of it. You need only to add them into description, at its end. You can put a sign like ----custom_fields---- or any other sign before them.

Example:

Description:

Bla bla bla ----custom_fields---- valuea : 225 , valueb : 35 , valuea1 : 225 , valueb1 : 40

When you display the description to the public, you run removeCustomFields($description);
When you save the item, you run addCustomFields($description).

You have there my example. If you can't do it by your self and no one is willing to help, you can pay a developer to do it.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Custom field search
« Reply #77 on: March 11, 2019, 06:39:38 pm »
It does not mater. the purpose is the same. That is a hack to leave the ft_min_word_len as it is (4 for example) but to enable the user to search by min 1 character. If you read there it is written.

Leave the title out of it. You need only to add them into description, at its end. You can put a sign like ----custom_fields---- or any other sign before them.

Example:

Description:

Bla bla bla ----custom_fields---- valuea : 225 , valueb : 35 , valuea1 : 225 , valueb1 : 40

When you display the description to the public, you run removeCustomFields($description);
When you save the item, you run addCustomFields($description).

You have there my example. If you can't do it by your self and no one is willing to help, you can pay a developer to do it.

Now i got you  :D I think this way is good to do. Lets do it. You try on your end and i try on my end. Whoever finishs the code earlier update this topic. Thanks

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Custom field search
« Reply #78 on: March 11, 2019, 07:01:52 pm »
osc_add_filter('item_add_prepare_data', 'cust_filter_title_description');
 osc_add_filter('item_edit_prepare_data', 'cust_filter_title_description');
 ?>

https://stackoverflow.com/questions/43015613/how-to-modify-ft-min-word-len-4-to-ft-min-word-len-1-so-that-osclass-3-7-1-can-s

@marius-ciclistu
By the way, i can search with min 3 characters or 2 or 1
I can search even with one character and it shows the result.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom field search
« Reply #79 on: March 11, 2019, 07:12:22 pm »
Then your ft_min_word_len is 1...that is not so good if you get many requests.... if you search 'a' you realize that the results will contain all the items.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Custom field search
« Reply #80 on: March 11, 2019, 07:52:47 pm »
Then your ft_min_word_len is 1...that is not so good if you get many requests.... if you search 'a' you realize that the results will contain all the items.

Yes. What is the proper way? How can i change it to standard way?
But if min 1 character is bad why are you trying to make minimum less than 4 characters on stackoverflow.com ?

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom field search
« Reply #81 on: March 11, 2019, 08:01:13 pm »
Shared hosting is cheaper.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Custom field search
« Reply #82 on: March 11, 2019, 10:13:33 pm »
Then your ft_min_word_len is 1...that is not so good if you get many requests.... if you search 'a' you realize that the results will contain all the items.

1. Yes. What is the proper way? How can i change it to standard way?
2. But if min 1 character is bad why are you trying to make minimum less than 4 characters on stackoverflow.com ?

Answer this please!

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom field search
« Reply #83 on: March 11, 2019, 10:16:16 pm »
I did. Shared hosting has 4.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Custom field search
« Reply #84 on: March 11, 2019, 11:27:18 pm »
Nope. Mine is on shared hosting and is 1 minimum search word. And i don't know why is 1 min. I use teseos search function for multiple languages, maybe that function makes it 1 min search word.

I did. Shared hosting has 4.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Custom field search
« Reply #85 on: March 24, 2019, 05:07:39 am »
@marius-ciclistu

what is the main differences between these 3 solutions?
as far as i know 2nd solution makes the search and server slow, right? if yes, for not making slow, 1st solution is good or 3rd solution?

First solution:
https://forums.osclass.org/development/please-help-to-do-this/msg159748/#msg159748

Second solution: (core)
https://forums.osclass.org/development/please-help-to-do-this/msg163268/#msg163268

Third solution: (adding custom-fields to description) (on progress!)
https://forums.osclass.org/development/please-help-to-do-this/msg167476/#msg167476

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom field search
« Reply #86 on: March 24, 2019, 09:29:20 am »
Now I see, I already gave you your so called 3rd solution into the first one. I forgot.
What more do you want?

First is faser than second in terms of searching because the search in description is full text search.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Custom field search
« Reply #87 on: March 24, 2019, 09:45:34 am »
Now I see, I already gave you your so called 3rd solution into the first one. I forgot.
What more do you want?

First is faser than second in terms of searching because the search in description is full text search.

 :D so first solution and third solution is the same!
And you recommend first solution because its faster and safe and has no bug!
Let me test the first solution and let you know!
Thanks Marius,

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom field search
« Reply #88 on: March 24, 2019, 10:00:02 am »
I did not test them.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Custom field search
« Reply #89 on: March 24, 2019, 08:32:24 pm »
@marius-ciclistu
i did everything you explained in the first solution but did not work! : (bender)
it just adds "\n\n" to the: Table: oc_t_item_description -> s_description