sqloracleoracle-text

oracle text definescore with accum and Query rewriting


I am using Oracle text to search in a corpus of sentences I want the scoring to be as counting the discrete occurrences only,

Example : My Query is ( dog cat table ) If it found the term " dog " it must count 1 even if the sentence has more than one "dog" term. If it found " dog cat " it must count 2 ... etc

I used this query, but it gives me 51 if it finds the two terms. I need to accumulate the discrete occurrences. So I want to override the behaviour of the scoring algorithm of Oracle Text.

   select /*+ FIRST_ROWS(1)*/ sentence_id
           ,score(1) as sc
           , isn 
           ,sentence_length 
   from       plag_docsentences 
   where contains(PROCESSED_TEXT,'DEFINESCORE(dog, DISCRETE*.01)
                                ,DEFINESCORE(cat, DISCRETE*.01)'
                    ,1)>0 
order by score(1) desc

Solution

  • OK, I Solved that Issue.

    suppose I find 2 terms out of 3, the score will be 67 which means ( 2/3=67 ) this is the default behavior of oracle text scoring alg. so I derived an equation to find the number of occurrences (i.e number of terms in query found in the corpus sentence) as follows:

    x/query_lenght = score/100

    then

    x=query_lenght * score/100

    this will find the number of matching words between the query and the corpus query

    I hope this will help reasearchers in IR.