I nead some help worh programming urgently please!

Discussion in 'Programming' started by nejcpass, Jul 3, 2007.

  1. #1
    first of all thanks for your help and this beatifull forum!

    My case is folowing:

    I have to pull out single words from the for instance #form.search# which contains "word1 word2 word3 word4"
    I nead to show every single of this words as variable of it's own.
    I nead it for full text search for CONTAINS(contains, 'word1 and word2 and word3 and word4')

    Thanks for your help.
     
    nejcpass, Jul 3, 2007 IP
  2. JasonBartholme

    JasonBartholme Peon

    Messages:
    396
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hello nejcpass,

    If I understand you correctly, you want to search for each word in a search string. I have used this method before.
    WHERE 0=0
    <cfloop index="x" list="#FORM.search#" delimiters=" ">
    <cfoutput>AND Content LIKE '%#x#%'</cfoutput>
    </cfloop>

    Hope this helps.
     
    JasonBartholme, Jul 3, 2007 IP
  3. nejcpass

    nejcpass Peon

    Messages:
    183
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Jason. I will try it out and give you an update
     
    nejcpass, Jul 4, 2007 IP
  4. nejcpass

    nejcpass Peon

    Messages:
    183
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It work well but I would nead it for instance when you search
    with ALL of the words, with the EXACT PHRASE ,with AT LEAST ONE of the words


    Your code tells that CONTAINS(contains, 'word1') and CONTAINS(contains, 'word2') and CONTAINS(contains, 'word3') and ... that doesn't help me much...

    I nead it formated like this:
    CONTAINS(contains, 'word1 and word2 and word3 and word4')
     
    nejcpass, Jul 4, 2007 IP
  5. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    >WHERE 0=0
    ><cfloop index="x" list="#FORM.search#" delimiters=" ">
    ><cfoutput>AND Content LIKE '%#x#%'</cfoutput>
    ></cfloop>


    what if you tried to set a cf variable to the search string.. like

    WHERE 0=0
    <cfloop index="x" list="#FORM.search#" delimiters=" ">
    <cfset contentstring = contentstring + '#x# and '>
    </cfloop>
    <cfset contentstring = rereplace(contentstring, '/and $/', '')>
    <cfoutput>CONTAINS(contains, '#contentstring#')</cfoutput>

    just me taking a guess at it.. i'm not the best with coldfusion syntax so i meant this just to give you an idea of something that might be able to be done
     
    Jamie18, Jul 5, 2007 IP