0

I have a table JobHead, and I create a Word-Index at PartDescription field in that table, as you see in the program below. I'm looking for the jobs with the word NUCLEAR inside of the PartDescription field. I can't get anything, what am I doing wrong?

DO:                      
OUTPUT TO VALUE("c:\Nuclear.txt").

    FOR EACH JobHead WHERE 
        JobHead.PartDescription CONTAINS "NUCLEAR" EXCLUSIVE-LOCK.

        DISPLAY JobHead.JobNum.
    END.

OUTPUT CLOSE.
END.
Abe Voelker
  • 30,124
  • 14
  • 81
  • 98
user1620378
  • 1
  • 1
  • 1

2 Answers2

0

The word index works on the full words, not on partial words. So in your code it will not find the text "NUCLEAR", if you had "NUCLEARISSAFE" in a record on PartDescription.

Note that, if you had "NUCLEAR-IS-SAFE" it would work, as progress behind the scene is indexing the words separately.

You could use the index keyword, but that's not indexed unfortunately, so would lock more records than necessary:

FOR EACH JobHead WHERE 
         INDEX(JobHead.PartDescription, "NUCLEAR") GT 0 EXCLUSIVE-LOCK.
TerryB
  • 629
  • 1
  • 5
  • 13
  • You can use wildcards however in your contains search... nuclear* would work just as well and get you the matches in your description. – DuStorm Oct 02 '12 at 14:52
0

Exactly the CONTAINS operator is working with the word break rules. Depending on the code page you are using these may be different. Note that for UTF-8 they are not defined out-of-the-box so you will receive an error unless you define it.

This KB article shows how to see which word break rules are in place KB article