[V4MD] Equivalent of V12's WordStarts operator?

Irv Kalb Irv at furrypants.com
Fri Sep 26 16:15:45 CDT 2008


I'm close, but it's not fully working.

I have a sample table with only one long field called 
AuthorYearRefKeywords.  I create a table from this data, and I tried 
marking the field as 'string', and also tried it as 'varchar' - I 
marked the field with the flag:  [#fIndexByWords].

If I look at the resulting table using Valentina Studio, and the one 
field in this table has a maximum size, a colon, and the letter W 
after it.   I assume that this tell me that is it is indexed by words.

In my application, I am taking user input, which may be multiple 
words, and building a query string to find matching records.  If the 
user types in:  Hays,  the query string I build is:

"SELECT AuthorYearRefKeywords FROM Biblio WHERE 
(left(AuthorYearRefKeywords,4) = 'Hays')"

It successfully finds five records that start with the word 'Hayes', like this:

       Hays, Kelley Ann, E. Charles Adams and Richard C. Lange, 1991, 
Regional Prehistory  ...

However, it does NOT find any records where the word 'Hays' is 
embedded in a record, like this:

       Adams, E. Charles and Kelley Ann Hays, (editors), 1991,\i 
Homol'ovi II: Archaeology ...


I tried the "LIKE" syntax, but it did not get any matches all.

I'm hoping that it's something simple.

Irv




At 7:32 PM +0300 9/26/08, Ruslan Zasukhin wrote:
>On 9/26/08 7:09 PM, "Irv Kalb" <Irv at furrypants.com> wrote:
>
>Hi Irv,
>
>>  Here's my question for the day ...
>>
>>  I'm translating code from a V12 driven application to Valentina.  In
>>  implementing a big glossary search, I used V12's 'WordStarts'
>>  operator in a SELECT statement.  I'm looking to see if there is
>>  anything that is equivalent in the Valentina world.  Here's the
>>  definition of WordStarts from the V12 documentation:
>>
>>  ----------------------------------
>>  The "wordStarts" operator can be used only with fields of type string
>>  (including
>>  custom string types) with defined full-indexes.  It locates records
>>  that contain words
>>  that fully or partially match the value specified to mSetCriteria.
>>  Example:
>>  mSetCriteria(gTable, "description", "wordStarts", "ham")
>>  sets records for selection containing descriptions such as "Gigantic
>>  hamburger with
>>  fries" and "The greatest hammer in the world". It does not find
>>  records containing
>>  descriptions such as "Champion" or "Gotham City" because the words in these
>>  records don't start with the sub-string "ham".
>>  Since "wordStarts" operates on full-indexes, searching is performed
>>  very quickly.
>>  --------------------------------------------------
>>
>>  I see that there is a 'findStartsWith', but it looks like that refers
>>  to just the beginning of the field.  Is there any operator that will
>>  look through the entire contents of a field, looking for a match on
>>  the beginnings of ANY word in the field?
>
>1) to get this working you need field VarChar or TEXT to be marked as
>IndexByWords.  TEXT field actually is marked in this way on default.
>
>As result Valentina will build for field special index by words.
>
>
>2) Now searches as
>
>     WHERE left(fld,3) = 'ham'
>
>Will do what you want. Valentina will use index to find all WORDS that sart
>with ham.
>
>
>3) Also you can use
>     WHERE fld LIKE 'ham%'
>
>Valentina engine also will see that you want find START WITH strings,
>And self will use INDEX By Words if it exists.
>
>4) also exists RegEX way.
>
>     this is just very powerful way, it can be not indexed,
>     but you can define just any expression by complexity.
>    
>
>
>
>--
>Best regards,
>
>Ruslan Zasukhin
>VP Engineering and New Technology
>Paradigma Software, Inc
>
>Valentina - Joining Worlds of Information
>http://www.paradigmasoft.com
>
>[I feel the need: the need for speed]
>
>
>_______________________________________________
>Valentina mailing list
>Valentina at lists.macserve.net
>http://lists.macserve.net/mailman/listinfo/valentina


-- 

Multimedia R Us


More information about the Valentina mailing list