SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: keyword index

  1. #1
    SitePoint Evangelist
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    keyword index

    Is there a way to set an index on words in a varchar field? Or do I just have to use a like query which I would think would be slow over a large file.

    To be clear, if I have a title field and the title is How to Cook Spaghetti and Meatballs, I would like it to index on Spaghetti, Meatballs, Cook, etc.

  2. #2
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well the way I do it is to process the input in my server-side language. I take the string "How to Cook Spaghetti and Meatballs", in this scenario and split it into constituent parts, which I then enter to a new table called something like 'meta tags' or 'search tags'.

    I store the filename or the parameters necessary for my page to display that content as well as the tags and I also store a description. That way, if someone gets more than one value for a search term, there is a descriptio that will give a bit more detail - just like when search mySQL docs or a search engine.

    I can't say for sure that the db table structure is correct but it seems to work for what I am doing.

    hth

    bazz

  3. #3
    SitePoint Evangelist
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I was keeping that as a backup and was hoping there was some "secret" index method in MySQL that would index the words something like a full text index but for regular varchar fields. Thanks for the input, I appreciate it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •