meijermanon
Total posts: 14
21 Март 2016 15:42

I have another problem that isn't easy to solve I'm afraid, because I have hardly any knowledge of PHP. Hope anybody can help.

My database (www.watzitwaarin.nl) contains over 10.000 records now, with products and their ingredients. Each record (product) has two textarea-fields with ingredients and the synonyms of these ingredients. With the search-form that I am using people can serach for instance for all sorts of ketchup that contain sugar. But I think there will be lots of people who would like to search for (for instance) ketchup WITHOUT sugar. So I would like to add that option to the search form. Anybody an idea how and where (which file) I can add this?

Manon

Последние изменения: 24 Март 2016


pepperstreet VIP
Total posts: 3,837
22 Март 2016 00:51

Hello Manon, which type of search do you use:

  • Joomla core search and Cobalt search plugin?
  • Smart Search/Finder
  • Cobalt Search input field (above list view)
  • Cobalt Advanced Search & Filters

meijermanon
Total posts: 14
22 Март 2016 06:30

I am using Cobalt advanced search & Filters.


pepperstreet VIP
Total posts: 3,837
22 Март 2016 18:41

Hello Manon, the only way to alter the search and results with "exclusion" is the Cobalt search input. It allows different search modes and you can enter search terms with a leading + or -. Since your information is stored in a textarea field, there is no exact filter capability. The textarea field content can be added to the search index only. Hence the field parameter "searchable". If you make changes to field parameters and the search mode, remember to use the re-index tool.

BTW, here is a related docs article, that might explain the background.


If you have very crucial information that you want to filter for, it should be stored in a field with filter parameters. i.e. the incredients should be separated values. This would allow exact filtering. You can set defaults to select from, and you can even allow to add more variants/values during submission.

You can't filter for "negative" results. I mean, you can filter for existing values, only. So you might create special fields or values that express the "negative" information.
e.g. sugar-free , no sugar , etc.

Hope this helps.


Sergey
Total posts: 13,748
23 Март 2016 02:21

I can suggest you to add autocomplete field with list of ingridients. It is quickly to add those in the form. And also that will give you special filter. For example user search text ketchup and ingridients sugar. He gets that.

Unfortunately there is no negation of filters.

But you may create ingridient Sugar free. SO user can search that too.

Those ingridients wil be like tags attached to recepie.


Jeff VIP
Total posts: 745
23 Март 2016 10:11

Sergey I can suggest you to add autocomplete field with list of ingridients. It is quickly to add those in the form. And also that will give you special filter. For example user search text ketchup and ingridients sugar. He gets that.

Well, good luck with editing 10.000 records then :-p

What if meijermanon was able to convert the text area field with ingredients into a checkbox or select list field. Currently values have to be seperated by a new line. But what if comma's were also accepted?


meijermanon
Total posts: 14
23 Март 2016 14:28

Thanks for the answers. But I'm not going to edit the 10.000 records :p. I have separate fields for product name, type, etcetera, only textarea fields for the ingredients. It is already possible to search for product type 'kethcup' and search text 'sugar'. But if I want the ketchups without sugar, it seems I have a problem. I read in the answer of pepperstreet that it is possible to use Bolean operators + and -. Then, in theory, one should be able to search for 'ketchup' as product type and -sugar as text search? But that doesn't seem to work. Anybody an idea?


Sergey
Total posts: 13,748
23 Март 2016 14:36

meijermanon and -sugar as text search? But that doesn't seem to work. Anybody an idea?

What is your search parameters in section? Fulltext?


pepperstreet VIP
Total posts: 3,837
23 Март 2016 14:50

Jeff Well, good luck with editing 10.000 records then :-p

What if meijermanon was able to convert the text area field with ingredients into a checkbox or select list field. Currently values have to be seperated by a new line. But what if comma's were also accepted?

Haha, as always: Great minds think alike. ;)

For sure this can't be a manual task. So I would recommend to export/import the records.

Just thinking loud...:

  • Maybe modify and reformat the values with an external editor and RegEx/GREP...
  • BTW, doesn't the export formatter allow custom templates?
    Maybe add PHP there and find/replace the "delimiters" inside the textarea fields during export...
  • Or manipulate the field values in a Database Backup directly. Then change field type...

meijermanon
Total posts: 14
23 Март 2016 18:19

The search parameters in the section appeared to be not Full text. I've changed them to full text, and then have to use the reindex tool, I suppose? But the re-indextool gives this message: Proxy Error

The proxy server received an invalid response from an upstream server. The proxy server could not handle the request POST /administrator/index.php.

Reason: Error reading from remote server

How do I solve this?

By the way: really appreciate all you thinking with me...


Sergey
Total posts: 13,748
24 Март 2016 09:20
Работает на Cobalt