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.

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');

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.