Home » Server Options » Text & interMedia » CONTEXT SCORE is equal...
CONTEXT SCORE is equal... [message #388173] Mon, 23 February 2009 11:01 Go to next message
ledo
Messages: 7
Registered: February 2009
Junior Member
I have tried many time to return the score(1) of a select statement using CONTEXT Index type and Contains Operator,

select score(1), Name_Col from Users where
contains(Name_Col, '?ahm',1)>0 order by score(1) DESC

all the returned results have the same score value, and when I tried to use another value as a search text, the score was the same for all the returned results too...

If anyone faced this case before, is there a logic error, or what is the algorithm for the score so as to analysis it well and see what is the reason for these strange view...

Thanks in advance
Re: CONTEXT SCORE is equal... [message #388216 is a reply to message #388173] Mon, 23 February 2009 20:38 Go to previous message
Barbara Boehmer
Messages: 7967
Registered: November 2002
Location: California, USA
Senior Member
If all of your matches are only single tokens, then they either match or don't match, so the scores rounded to whole numbers are likely to be the same. If there are multiple matches within the column, then the scores are likely to be farther apart, as demonstrated below. You can also specify weight with the newer fuzzy syntax, instead of the question mark:

http://download.oracle.com/docs/cd/B28359_01/text.111/b28304/cqoper.htm#CCREF0307


SCOTT@orcl_11g> CREATE TABLE users
  2    (name_col  VARCHAR2 (30))
  3  /

Table created.

SCOTT@orcl_11g> INSERT ALL
  2  INTO users (name_col) VALUES ('ahm')
  3  INTO users (name_col) VALUES ('ahmm')
  4  INTO users (name_col) VALUES ('ahm ahm ahm')
  5  SELECT * FROM DUAL
  6  /

3 rows created.

SCOTT@orcl_11g> INSERT INTO users (name_col)
  2  SELECT object_name
  3  FROM   user_objects
  4  /

606 rows created.

SCOTT@orcl_11g> CREATE INDEX users_name_col_idx
  2  ON users (name_col)
  3  INDEXTYPE IS CTXSYS.CONTEXT
  4  /

Index created.

SCOTT@orcl_11g> select score(1), Name_Col
  2  from   Users
  3  where  contains (Name_Col, '?ahm',1) > 0
  4  order  by score(1) DESC
  5  /

  SCORE(1) NAME_COL
---------- ------------------------------
        31 ahm ahm ahm
        10 ahm
        10 ahmm

SCOTT@orcl_11g>

[Updated on: Mon, 23 February 2009 20:42]

Report message to a moderator

Previous Topic: CATSEARCH with Fuzzy Matching...?
Next Topic: Index Creation
Goto Forum:
  


Current Time: Fri Aug 22 05:01:34 CDT 2014

Total time taken to generate the page: 0.10654 seconds