Jump to content

How can I group items together from multiple fields


HGeneAnthony

Recommended Posts

I'm using a full text search for keywords. From what I gathered full text search needs all items to be in their own field in order for me to write something like +linux -windows. Without linux and windows being in their own field it won't work right. What I'd like to do is be able to take the results and find out which keywords had hits and how many. For example, if I searched on Linux and opensource was a common keyword among the results I'd like to find out how many times it came up. The problem is since one record might have opensource as the third keyword given and another record might have it as the second given they'd be in seperate fields. So I was wondering is there a way I can group the fields together and make this work.

Link to comment
Share on other sites

Create a composite fulltext index rather than separate ones for each field.

 

create the index like this:-

alter table xyz add fulltext index abc (FIELD1,FIELD2,FIELD3);

 

Query the table like this:-

select * from xyz where match(FIELD1,FIELD2,FIELD3) against ('+linux -windows');

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.