11 Posts
pikilon
10 years ago
4
Topic

Hi, I was looking to create this for long time ago and I finally find a way. Seblod is so great that I want to return some to community. (Maybe my solution sucks and there is another easier way).

Main target: Make a text search field that to look in several other fields to match (for example meta keywords, meta description, fulltext, introtext and title)

You will need a very basics in mysql.

  1. Create a table in your database (jos_searchview) that will contain 2 columns (We're not going to duplicate data on the database, don't worry)
    1. id: This will have the article id of the content. 
    2. combinedfields (or whatever): this will contain the data you are going to search in.
  2. Create a custom field called search_content_combined : Create a custom field called search_content_combined : This field have to store its data in the table we've just created.This field have to store its data in the table we've just created.t created.
  3. Give it a try in the admin form and see that the field store and the id. After this test remove the field from the admin form. You can skip this step if you feel confident.
  4. Delete (drop) the table you created in step 1.
  5. Create a "View" with the very same name and columns that the table you have just drop. Use concat in mysql to combine this fields.
    FAST EX: 

    CREATE VIEW jos_searchview AS
    SELECT id CONCAT('introtext', `fulltext`,
    metakey,metadesc) as combinedfields FROM jos_content 
    WHERE published = 1

  6.  Add the custom field to the search type and add the parameters as you like (exact, all words, any words, etc)

It is a view, so it will update by itself and you don't have to store/mantain the content twice.

I haven't test to do it directly with steps 5, 2 and 6 (in that order) but if seblod doesn't do something strange (like check the table is writable) I don't see why it can't works perfectly well.

Sure there is another way of doing this. Please let me know. If don't I am glad to help.





Get a Book for SEBLOD
10 years ago
0
Level 1

Hello pikilon,

the other easier way is to use the plugin Search Generic.

it will cost you a bit, but you won't have to do anything (create table, ...).


Regards.

Lionel

59 Posts
kobalt
10 years ago
2
Level 1
Hi pikilon,
You should support the Seblodteam for the great work and buy this plugin and others. I have my money well spent and save a lot of time.
Regards
kobalt


11 Posts
pikilon
10 years ago
0
Level 2

I agree, I'll support the seblod team. The next time I use a combined search I'll buy it. (very soon, I use seblod in almost every site I made)

It would be nice to pay for support suscription. It is possible?

It would be nice also to remove the html comments by paying


11 Posts
pikilon
10 years ago
0
Level 2

It didn't take so long.
I purchased it.

Much, much easier

Get a VIP membership