sql logic

Discussion in 'iOS Programming' started by chhoda, Jul 11, 2013.

  1. chhoda macrumors 6502

    Joined:
    Oct 25, 2008
    #1
    hi all,

    i understand this may not be a direct ios question but it is related to.

    i am developing an application in ios sqlite where i ned to search a db with records ordered by o of words found in the search string.

    for example if the search string "x y" strings containing x y will appear first, then strings containing x and then y.

    the question is is there a straight sql query to do this ? or i need to write my own function ?

    regards
    ch
     
  2. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #2
    Searching strings within strings can be costly.

    Check out LIKE.
     
  3. chhoda thread starter macrumors 6502

    Joined:
    Oct 25, 2008
    #3
    I thought somebody will come up with a query that works :) , is it possible with only sql or i need to write logic with obj c and sql ?
     
  4. lucasgladding, Jul 17, 2013
    Last edited: Jul 17, 2013

    lucasgladding macrumors 6502

    Joined:
    Feb 16, 2007
    Location:
    Waterloo, Ontario
    #4
    I don't have much experience with it, but this is probably a good place to start reading:
    http://www.sqlite.org/fts3.html#section_1_4

    Full-text search in SQL differs between implementations (i.e. MySQL, SQLite, MSSQL, etc), so you should be looking for examples specific to the implementation you're using. I have very limited experience with search, hence the vague response. Sorry I couldn't be more help.
     

Share This Page