How does ACCUM work?

Hi there,
I have a problem understanding how ACCUM works. We are using a text index over XML documents and want to apply a very simple relevance weighting based on occurences within a certain tag. For example, if TAG1 has a weight of 10, each occurrence in TAG1 should add 10 to the score. We have 13 Tags that should be weighted and multiple occurences in different tags should be cumulated. So 3 occurences in TAG1 (weight 10) and one occurence in TAG2 (weight 7) should result in a score of 37.
Just searching in TAG1 works as expected:
( DEFINESCORE( foo, OCCURRENCE ) WITHIN TAG1 ) * 10Three occurences score 30.
Just searching in TAG2 works also as expected. One occurence scores 7. However, when I combine both searches
(( DEFINESCORE( foo, OCCURRENCE ) WITHIN TAG1 ) * 10) ACCUM (( DEFINESCORE( foo, OCCURRENCE ) WITHIN TAG2 ) * 7)the score is 61 instead of 37. More interestingly, including all 13 tags (of which most do not contain the search word) lowers the score again.
I ended up with searches where two documents containing completely different occurrences of a search word got exactly the same score.

I usually prefer to use a function to format the search string. I make sure that the function has default values for any nulls. In the following demonstration, I added some data to Roger's example, created a function that accepts four sets of words/phrases, tags, and weights, and one operator, with default values, and builds the search string. I then demonstrated what the function returns, based on some sample values for the variables, then usage of the function in a query. I made the NOT part of the words/phrases variables, but you could separate that into four separate variables as well.
-- table, data, and index:
SCOTT@orcl_11gR2> create table mytab(text varchar2(255));
Table created.
SCOTT@orcl_11gR2> insert into mytab values ('
  2    <tag0>
  3        <tag1> foo foo foo </tag1>
  4        <tag2> foo foo     </tag2>
  5        <tag3> bar         </tag3>
  6        <tag4> baz         </tag4>
  7    </tag0>
  8  ');
1 row created.
SCOTT@orcl_11gR2> insert into mytab values ('
  2    <tag0>
  3        <tag1> foo foo foo </tag1>
  4        <tag2> foo foo     </tag2>
  5        <tag3> bar         </tag3>
  6        <tag4> bar         </tag4>
  7    </tag0>
  8  ');
1 row created.
SCOTT@orcl_11gR2> create index mytabindex on mytab (text) indextype is ctxsys.context
  2  parameters ('section group ctxsys.auto_section_group');
Index created.-- function:
SCOTT@orcl_11gR2> CREATE OR REPLACE FUNCTION format_search
  2    (p_word1    IN VARCHAR2,
  3       p_tag1        IN VARCHAR2,
  4       p_weight1  IN NUMBER,
  5       p_word2    IN VARCHAR2,
  6       p_tag2        IN VARCHAR2,
  7       p_weight2  IN NUMBER,
  8       p_word3    IN VARCHAR2,
  9       p_tag3        IN VARCHAR2,
10       p_weight3  IN NUMBER,
11       p_word4    IN VARCHAR2,
12       p_tag4        IN VARCHAR2,
13       p_weight4  IN NUMBER,
14       p_operator IN VARCHAR2)
15    RETURN           VARCHAR2
16  AS
17    v_search_string      VARCHAR2(32767);
18  BEGIN
19    v_search_string := 'DEFINEMERGE((';
20    IF p_word1 IS NOT NULL AND p_word1 NOT LIKE 'NOT %' THEN
21        v_search_string := v_search_string
22        || CHR(10) || '((DEFINESCORE(' || p_word1 || ',OCCURRENCE) WITHIN '
23        || NVL (p_tag1, 'tag0') || ')*' || NVL (p_weight1, 1) || '),';
24    END IF;
25    IF p_word2 IS NOT NULL AND p_word2 NOT LIKE 'NOT %' THEN
26        v_search_string := v_search_string
27        || CHR(10) || '((DEFINESCORE(' || p_word2 || ',OCCURRENCE) WITHIN '
28        || NVL (p_tag2, 'tag0') || ')*' || NVL (p_weight2, 1) || '),';
29    END IF;
30    IF p_word3 IS NOT NULL AND p_word3 NOT LIKE 'NOT %' THEN
31        v_search_string := v_search_string
32        || CHR(10) || '((DEFINESCORE(' || p_word3 || ',OCCURRENCE) WITHIN '
33        || NVL (p_tag3, 'tag0') || ')*' || NVL (p_weight3, 1) || '),';
34    END IF;
35    IF p_word4 IS NOT NULL AND p_word4 NOT LIKE 'NOT %' THEN
36        v_search_string := v_search_string
37        || CHR(10) || '((DEFINESCORE(' || p_word4 || ',OCCURRENCE) WITHIN '
38        || NVL (p_tag4, 'tag0') || ')*' || NVL (p_weight4, 1) || '),';
39    END IF;
40    v_search_string := RTRIM (v_search_string, ',') || CHR(10) || '),'
41        || NVL (p_operator, 'OR') || ',ADD)';
42    IF p_word1 LIKE 'NOT %' THEN
43        v_search_string := v_search_string
44        || CHR(10) || 'NOT (' || SUBSTR (p_word1, 5) || ' WITHIN '
45        || NVL (p_tag1, 'tag0') || ')';
46    END IF;
47    IF p_word2 LIKE 'NOT %' THEN
48        v_search_string := v_search_string
49        || CHR(10) || 'NOT (' || SUBSTR (p_word2, 5) || ' WITHIN '
50        || NVL (p_tag2, 'tag0') || ')';
51    END IF;
52    IF p_word3 LIKE 'NOT %' THEN
53        v_search_string := v_search_string
54        || CHR(10) || 'NOT (' || SUBSTR (p_word3, 5) || ' WITHIN '
55        || NVL (p_tag3, 'tag0') || ')';
56    END IF;
57    IF p_word4 LIKE 'NOT %' THEN
58        v_search_string := v_search_string
59        || CHR(10) || 'NOT (' || SUBSTR (p_word4, 5) || ' WITHIN '
60        || NVL (p_tag4, 'tag0') || ')';
61    END IF;
62    RETURN v_search_string;
63  END format_search;
64  /
Function created.
SCOTT@orcl_11gR2> SHOW ERRORS
No errors.-- variables and values::
SCOTT@orcl_11gR2> VARIABLE g_word1    VARCHAR2(100)
SCOTT@orcl_11gR2> VARIABLE g_tag1     VARCHAR2(100)
SCOTT@orcl_11gR2> VARIABLE g_weight1  NUMBER
SCOTT@orcl_11gR2> VARIABLE g_word2    VARCHAR2(100)
SCOTT@orcl_11gR2> VARIABLE g_tag2     VARCHAR2(100)
SCOTT@orcl_11gR2> VARIABLE g_weight2  NUMBER
SCOTT@orcl_11gR2> VARIABLE g_word3    VARCHAR2(100)
SCOTT@orcl_11gR2> VARIABLE g_tag3     VARCHAR2(100)
SCOTT@orcl_11gR2> VARIABLE g_weight3  NUMBER
SCOTT@orcl_11gR2> VARIABLE g_word4    VARCHAR2(100)
SCOTT@orcl_11gR2> VARIABLE g_tag4     VARCHAR2(100)
SCOTT@orcl_11gR2> VARIABLE g_weight4  NUMBER
SCOTT@orcl_11gR2> VARIABLE g_operator VARCHAR2(100)
SCOTT@orcl_11gR2> BEGIN
  2    :g_word1 := 'foo';
  3    :g_tag1 := 'tag1';
  4    :g_weight1 := 10;
  5    :g_word2 := 'foo';
  6    :g_tag2 := 'tag2';
  7    :g_weight2 := 7;
  8    :g_word3 := 'foo';
  9    :g_tag3 := 'tag3';
10    :g_weight3 := 5;
11    :g_word4 := 'NOT baz';
12    :g_tag4 := 'tag4';
13    :g_operator    := 'OR';
14  END;
15  /
PL/SQL procedure successfully completed.-- what the function returns:
SCOTT@orcl_11gR2> SELECT format_search
  2             (:g_word1, :g_tag1, :g_weight1,
  3              :g_word2, :g_tag2, :g_weight2,
  4              :g_word3, :g_tag3, :g_weight3,
  5              :g_word4, :g_tag4, :g_weight4,
  6              :g_operator)
  7  FROM   DUAL
  8  /
FORMAT_SEARCH(:G_WORD1,:G_TAG1,:G_WEIGHT1,:G_WORD2,:G_TAG2,:G_WEIGHT2,:G_WORD3,:
DEFINEMERGE((
((DEFINESCORE(foo,OCCURRENCE) WITHIN tag1)*10),
((DEFINESCORE(foo,OCCURRENCE) WITHIN tag2)*7),
((DEFINESCORE(foo,OCCURRENCE) WITHIN tag3)*5)
),OR,ADD)
NOT (baz WITHIN tag4)
1 row selected.-- query using function:
SCOTT@orcl_11gR2> SELECT SCORE(1) FROM mytab
  2  WHERE  CONTAINS
  3             (text,
  4              format_search
  5             (:g_word1, :g_tag1, :g_weight1,
  6              :g_word2, :g_tag2, :g_weight2,
  7              :g_word3, :g_tag3, :g_weight3,
  8              :g_word4, :g_tag4, :g_weight4,
  9              :g_operator),
10              1 ) > 0
11  /
  SCORE(1)
        44
1 row selected.

Similar Messages

  • How does this work?

    This is not a complaint, but a confused sigh of admiration. I've got an email account at the university where I teach. When I got my iBook, it took me a while, and a few conversations with IT at the school, to get this account working in the Mail application. (Since I have a Verizon DSL at home, I had to include that SMTP as the outgoing server.) Anyway, I synched this mail account (along with my AOL and .Mac accounts) onto the iPhone, and it works perfectly, both incoming and outgoing. I didn't have to change any of the settings. I thought I was computer savvy, but I can't wrap my mind around this. It seems like magic. How does it work?

    The sync process with iTunes transfers the email account settings (for your chosen accounts via your iPhone sync preferences) from the Mail application on your Mac to the iPhone's email application.
    The iPhone is running OS X and the iPhone's email client can be considered a mobile version of the Mail application.

  • My iPhone was stolen and I have contacted the police who are using the meid number to locate.  How does this work and what are my chances of getting the phone back?

    My iPhone was stolen.  I used Find My iPhone app to lock it and display a message.  The phone has not connected to the internet to locate it.  I contacted the police and they have taken my meid number.  How does this work and what are my chances of getting the phone back?  Are there other ways the theif can use it.  I was told once they put in a new sim card and use it, whatever software the police have, it will show up.

    Honestly? In the US (I can't speak to other countries, though I doubt it works much differently in a lot of the world) The police took your report and filed it either in their computers or, on paper. They will now not think of this again. The only time it will cross anyones mind is if, in the course of entering information into evidence about items recovered or seized at a crime scene, the serial number of an iPhone that was found/seized happens to match yours, in which case you will be contacted.
    The police in the US can and will do nothing to 'blok' the phone and it's not worth their time to try and locate it unless you know for a fact that it was stolen by a big time drug lord, master criminal, or some other such prime target and they can get a court order to track the location of the phone in order to locate this individual for your own purposes.  If they do that, they'll probably keep him under surveilance for a year or so before they act.
    Basically, the police don't care about your phone. If they find it, they will give it back to you. They are not, however, going to go looking for it. They have better things to do.
    I'm sorry, but that's the way it is.

  • Was told a USB device would create a PDF automatically from the data contained within when plugged into my USB port. Doesn't seem to work. How does this work and how can I fix the device I received?

    Acrobat is not on the USB device - only Adobe Reader needed on the PC. How does this work? How can I fix this device if at all?

    You need to ask the people who sold it to you. Doesn't sound like it has anything to do with Reader.
    However, you should be wary of devices that automatically try to open files when plugged in. They can also infect your computers with all kinds of viruses or malware.

  • HT2357 So how does this work on Mountain Lion? I cannot seem to ignore the iTunes 11 updates, which now seem to appear every 5 minutes!!

    So how does this work on Mountain Lion? I cannot seem to ignore the iTunes 11 updates, which now seem to appear every 5 minutes!!

    Fantastic!  Didn't work at first so restarted App store and tried again.  This time it asked 'ignore update'.  All gone!

  • TS1425 My co worker has given me his iPod to take home and transfer his music to my laptop, however, I am unable to access his music to download it to my computer.  How does this work?

    My co-worker has given me his iPod to take home and transfer his music to my laptop, however, I am unable to access his music to download it to my computer.  How does this work?

    You need to transfer the iTunes Library from the most recent backup you made before the hard drive was replaced.
    You can't transfer the full iTunes Library from the iPad back to iTunes.
    There are third-party Windows applications that will transfer data from an iOS device, but they don't re-create the iTunes Library exactly as it was before.

  • How does Remote work with Apple TV?

    How does Remote work with Apple TV?
    1. Does Remote, "Play" the music that resides on your iPod Touch>Apple TV>Home Speakers.
    OR
    Does Remote "Control" the music that resides on Apple TV HD>Home Speakers.
    (If so... say you have a iPod Touch that only holds 8GB's but your music collection on your Apple TV exceeds that amount.
    Will Remote still "Control" the larger music collection on Apple TV or your computer?)
    2. Will iPod Wifi work on a patio outside a home to control Apple TV inside the home?
    thank you in advance, Tom

    Remote is a way to control iTunes on either your computer or Apple TV using a WiFi connection. See this article for complete instructions.

  • I got a itunes gift card and when i try and buy some thing it asks me for my credit card details how does that work when i have £15 on my fone that i got on a gift card?

    i got a itunes gift card and when i try and buy some thing it asks me for my credit card details how does that work when i have £15 on my fone that i got on a gift card? as i am trying to buy a song and it is starting to really cheese me of now where it keeps asking for credit card details is there a way round it with out having to use a credit card?

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • I would like to know which app/software in MAC gives us the same feature that is provided by System Restore in Windows, and how does that work

    I would like to know which app/software in MAC gives us the same feature that is provided by System Restore in Windows, and how does that work.

    Time Machine is one such program, although it is a recursive backup program which offers limited archive capability, based on the capacity of the backup destination, and it requires you set it up before you start editing your files.   Some programs are also Versions aware, which offers a kind of restore capability by file.  Again needs to be setup before you start editing.
    Just a for-your-info:
    Mac is not an acronym, it is a nickname for Macintosh.

  • Itunes 11.1.5 will not sync new apps with iPhone 5 iOS 7.0.6 and gives grayed out "install" no message?  How does one work around this?

    Itunes 11.1.5 (MacBook Pro,OS 10.6.8) will not sync new apps with iPhone 5 iOS 7.0.6 and gives grayed out "install" no message?  How does one work around this?

    Just reboot your laptop... While its rebooting try to reboot your phone also by holding the home and power buttonn for 10-15 seconds...When your phone is turned off try to connect it to iTunes and it will recognize your phone in recovery mode.
    If you have the .ipsw file for iOS 7.0.6 saved in your desktop then in itunes press shift and click on Restore.
    Select the ipsw file and let it restore.
    If you dont have it downloaded then simply click on restore.
    I hope it works
    Cheers !

  • What is efax and how does it work?

    Hi!
    eFax® is a service provided by eFax®, not Hewlett-Packard, that allows you to send and receive faxes using the Internet rather than a phone line. eFax® is easy to use, but it is different than a typical phone-based fax machine. You don't require a phone line to use it, so you don't have to worry about busy signals and you can place your printer where you want it, not where the phone jacks are located! The fax number you are provided will not typically be a local number, and may even be in a different country. You will receive 20 incoming and 20 outgoing fax pages per month for free with this service. Your page counts will reset at midnight Pacific Time on the first of each month. You can also subscribe to eFax® Plus to obtain additional pages per month by visiting: http://www.eFax.com/products/internet-fax.
    How does it work?
    eFax® uses the printer Internet connection to send and receive faxes. When you send a fax, it is sent over the Internet to the eFax® server and then eFax® sends your fax to the recipient's fax machine over a standard phone line.
    Your faxes are received in a similar manner, but the order is reversed. The sender sends the fax over a phone line to eFax® and then eFax® sends the fax to your printer using HP's ePrint service.
    This question was solved.
    View Solution.

    Hi Im_cheesecake,
    Great information, if you don't mind I just wanted to piggy back off of your post, to clear any potential confusion.
    The 20 free incoming & 20 free outgoing faxes are with HP printer's that include the eFax service print app.  As of now, we have three printer series' that include the pre-installed eFax print app: HP Photosmart 7510 Series, HP Envy 110 Series, and the HP Photosmart eStation C510a.  
    eFax also has a free plan which allows you to receive a limited number of faxes but does not allow you to send any faxes. If you exceed the number of received faxes allowed, eFax will prompt you to upgrade to a paying account. Here are the main details of the free plan:
    One remote (i.e. non-local) eFax number
    Area code/prefix is selected by eFax and cannot be changed (unless you upgrade to a paid account)
    20 incoming fax pages per month (receive-only)
    You are prompted to upgrade to a paying account if you exceed 20 incoming pages, or if you need send capability.
    Say "Thanks" by clicking the blue Kudos Star in the post that helped you.
    Please mark the post that solves your problem as "Accepted Solution"; therefore, it's easier for others to find.
    I am an HP employee.

  • Hi i want to send an ipad of a gift to a friend in italy, can it be done? will the wifi and 3g still work? also how does it work for a warrenty?

    hi i want to send an ipad of a gift to a friend in italy, can it be done? will the wifi and 3g still work? also how does it work for a warrenty?

    WiFi will work, cellular will work but they may not be able to access LTE, they will have to send it back to you for the warranty work.

  • JDBC Adapter:- How does it work??

    Dear Friends,
    I would like to know the nuts and bolts of JDBC adapter.
    1.)How does it work internally?Internally what does sap use?
    2.)In my scenario i just need to access a sap table so Can i write my Java JDBC program to access it.?
    3.)Is there any other way to sent data from Idocs to map to a external database with out using XI.?
    thx,
    jeevan

    Hi Jeevan,
    As far as the JDBC adapter goes, internally it uses, obviously JDBC (Java DataBase Connectivity). Thus all the calls from this adapter are internally SQL Queries (Either Select, Insert, Update, Delete, Execute Stored Procedure) that are sent using Java JDBC API.
    In Sender Configuration, it needs a Select and an Update query to be configured into it. It polls the External Database at specific intervals (Polling Interval in the Channel Configuration),i.e., it connects to the Database via a JDBC Connection and runs the select query. The data from the query is sent to XI as an XML Document. The update query is used to update the DB such that the same data is not picked again in the next poll. This is generally done through a status field. The select query's Where clause should pick records with one status and the update should change all those statuses so that the select does not pick them again. Click [Here|http://help.sap.com/saphelp_nw70/helpdata/EN/22/b4d13b633f7748b4d34f3191529946/frameset.htm|SAP Help on JDBC Sender Adapter] for more details, including the format of the XML file sent.
    In receiver configuration, the channels creates SQL statements from the XML Document it receives. This can be either Select, Insert, Update, Delete or Stored Procedure Call Statements. This requires you to give the receiver channel an XML Document in a pre-defined Schema. Click [Here|http://help.sap.com/saphelp_nw70/helpdata/EN/22/b4d13b633f7748b4d34f3191529946/frameset.htm|SAP Help on JDBC Receiver Adapter] for more details including correct XML Schemas. Note that the kind of SQL Statement generated (Select, Update, etc) is dependent on the schema provided.
    Hope this was helpful!!!
    Thanks,
    Guru

  • The special offer for the printer that is going on with a Mac, how does that work? Is it true i can get a free printer?

    The special offer for the printer that is going on with a Mac, how does that work? Is it true i can get a free printer?

    you pay for it up front, and they give you a rebate or $99, so if you buy a $99 printer from them (Epson Stylus NX430 Small-in-One Color Inkjet Printer $99.95) then the printer becomes free. You can not get this deal unless you also buy a mac with it.

  • Outbound Dialer records to cache. how does it work?????

    Im confused, on the campaign manager one of the settings for the campaigns is
    Records to cache.  The Outbound guide says that this is "the minimum number of dialing numbers
    that each dialer caches for each of your outbound option skill groups.  Default is 100"
    how often does it cache?
    how does this work?
    Lets says I have an agent campaign mode:Predictive_Blended,
    Records to cache: 1, everything else default.
    My Admin script is set to cycle every 1 minute.
    does this mean that 1 record get cached every minute?
    thanks

    Hi
    From what I have seen it is the number of records that the dialer fetches from the database at any given moment. The dialer cahches these records and dials them.  As soon as it exausts then it fetches more.
    Victor

Maybe you are looking for

  • Can't transfer rentals to ATV1. Possible?

    I thought, according to the wording of the iTunes Store rental information, that I should be able to transfer rentals of TV shows from my laptop to my 1st gen Apple TV (OS 3.0.2). However, after renting several episodes of a show, I find no option to

  • How to use call transaction stmt from webdynpro application

    Hi Expers, Can I use call transaction 'tcode' in my webdynpro application, I have tried in my application but i am getting short dump saying Error analysis+ An exception occurred that is explained in detail below.The exception, which is assigned to c

  • Getting self-made artwork into library

    Hello I can't seem to figure out how to get artwork that I made into iTunes. It's for printing on a jewelcase cover, that I'm putting together. iTunes Help says it can be done; that I can import it into the library and select it from there. But I can

  • PS CS free upgrade to CS2

    I have an old version of PS with 4 licenses. I upgraded one of them to CS2 for free. Now I want to install the rest. How do I go about getting the serial #'s?

  • Glitched video preview!

    This is really annoying, after trying the 30-day-trial I went and bought the softwere (Adobe Premiere Pro CC 2014). Why doesn't the video preview work anymore? It only works when the video is playing but when I stop to fine tune my edit this happens: