How do I best perform ctx_doc.markup for a batch/set of documents?

Hi,
I'm are working on a system that stores chat messages in a table where the message body is stored in a CLOB column. I'm starting to implement a full text message search using Oracle Text and am looking to use the ctx_doc.markup feature to markup the search terms. The message table is pretty much like:
CREATE TABLE message (
  id NUMBER(19,0),
  sender NUMBER(19,0),
  recipient NUMBER(19,0),
  received_at TIMESTAMP (6),
  data CLOB,
and we have a context text index on the 'data' column and 'contains' queries against it work just fine. When I was looking to add the ability to markup the search terms, I was a bit surprised that there doesn't seem to be an easy way to markup a whole set of results.
What I'm planning doing is basically:
begin
  ctx_doc.markup(index_name => 'MESSAGE_DATA_TXT_IDX',
                      textkey => '2523992',
                      text_query => 'test"',
                      restab => 'message_search_result_markup',
                      query_id => '4',
                      tagset => 'TEXT_DEFAULT');
end
So in my case, a search could result in hundreds of messages being returned. Now in order to mark all of them up, I have to do a 'ctx_doc.markup' for each one, i.e. hundreds of times which seems horribly inefficient. Also keep in mind that all of this is done in a Java web service.
So my first question is, why doesn't 'markup' allow a list of ids to be passed in for the 'textkey'? That would make things much simpler like:
  ctx_doc.markup(index_name => 'MESSAGE_DATA_TXT_IDX',
                      textkey => '2523992,2523993,2523994,2523995',
                      text_query => 'test"',
                      restab => 'message_search_result_markup',
                      query_id => '4',
                      tagset => 'TEXT_DEFAULT');
which would then end up with 4 rows with query_id 4 in the message_search_result_markup table.
I then figured well since I generate the SQL in Java, I can just add a whole bunch of these calls into the begin/end block like
begin
     ctx_doc.markup(...);
     ctx_doc.markup(...);
     ctx_doc.markup(...);
     ctx_doc.markup(...);
end
basically one for each found message. However now I have the problem of tying a marked up result back to the actual message since the marked up result doesn't store the message primary key that's passed in as the 'textkey'. If the schema of the restab table would be something like
    create table message_search_result_markup (query_id  number, textkey varchar2, document  clob);
Then I could have a unique query_id for each query and be able to easily retrieve all the markup results and return them along with other data from the matched messages like the sender, recipient, timestamp, etc.
So now what I'm thinking is that for each 'textkey' I have, I have to create a unique query_id which isn't that straight forward since everything is multithreaded and multiprocess and different queries can return the same messages, so I couldn't just use the textkey as the query_id.
Does anybody have any better suggestions/ideas?
Keep in mind that I want to minimize the number of SQL queries I have to make from Java, ideally only having to make 1 query for the message search, 1 query to markup the found messages and 1 more query to get the marked up results.

You could write a user-defined wrapper function for the ctx_doc.markup procedure, so that you could use it in a SQL query.  Please see the demonstration below.
SCOTT@orcl12c> -- table, data, and index for testing:
SCOTT@orcl12c> CREATE TABLE message
  2    (id         NUMBER(19,0),
  3      sender         NUMBER(19,0),
  4      recipient    NUMBER(19,0),
  5      received_at  TIMESTAMP (6),
  6      data         CLOB)
  7  /
Table created.
SCOTT@orcl12c> INSERT ALL
  2  INTO message (id, data) VALUES
  3    (1, 'I''m are working on a system that stores chat messages in a table where the message body is
  4       stored in a CLOB column. I''m starting to implement a full text message search using Oracle
  5       Text and am looking to use the ctx_doc.markup feature to markup the search terms.
  6       The message table is pretty much like:')
  7  INTO message (id, data) VALUES
  8    (2, 'and we have a context text index on the ''data'' column and ''contains'' queries against it
  9      work just fine. When I was looking to add the ability to markup the search terms, I was a bit
10      surprised that there doesn''t seem to be an easy way to markup a whole set of results. ')
11  SELECT * FROM DUAL
12  /
2 rows created.
SCOTT@orcl12c> CREATE INDEX message_data_idx ON message (data) INDEXTYPE IS CTXSYS.CONTEXT
  2  /
Index created.
SCOTT@orcl12c> -- user-defined wrapper function for ctx_doc.markup procedure:
SCOTT@orcl12c> CREATE OR REPLACE FUNCTION your_markup
  2    (p_index_name IN VARCHAR2,
  3      p_textkey    IN VARCHAR2,
  4      p_text_query IN VARCHAR2,
  5      p_plaintext  IN BOOLEAN  DEFAULT TRUE,
  6      p_starttag   IN VARCHAR2 DEFAULT '<<<',
  7      p_endtag     IN VARCHAR2 DEFAULT '>>>',
  8      p_key_type   IN VARCHAR2 DEFAULT 'ROWID')
  9    RETURN        CLOB
10  AS
11    v_clob        CLOB;
12  BEGIN
13    CTX_DOC.SET_KEY_TYPE (p_key_type);
14    CTX_DOC.MARKUP
15       (index_name => p_index_name,
16        textkey    => p_textkey,
17        text_query => p_text_query,
18        restab     => v_clob,
19        plaintext  => p_plaintext,
20        starttag   => p_starttag,
21        endtag     => p_endtag);
22    RETURN v_clob;
23  END your_markup;
24  /
Function created.
SCOTT@orcl12c> SHOW ERRORS
No errors.
SCOTT@orcl12c> -- query:
SCOTT@orcl12c> COLUMN kwic FORMAT A60 WORD_WRAPPED
SCOTT@orcl12c> SELECT id,
  2          your_markup
  3            ('message_data_idx',
  4             ROWID,
  5             'column') kwic
  6  FROM   message
  7  WHERE  CONTAINS (data, 'column') > 0
  8  /
        ID KWIC
         1 I'm are working on a system that stores chat messages in a
           table where the message body is
           stored in a CLOB <<<column>>>. I'm starting to implement a
           full text message search using Oracle
           Text and am looking to use the ctx_doc.markup feature to
           markup the search terms.
           The message table is pretty much like:
         2 and we have a context text index on the 'data' <<<column>>>
           and 'contains' queries against it
           work just fine. When I was looking to add the ability to
           markup the search terms, I was a bit
           surprised that there doesn't seem to be an easy way to
           markup a whole set of results.
2 rows selected.

Similar Messages

  • How do I best integrate existing laptops for a new server?  Can I use the existing home folders on the laptops and make them into Network Users?

    How do I best integrate existing laptops for a new server?  Can I use the existing home folders on the laptops and make them into Network Users?

    Yes it will work.  I've done it for a few users in my small office.  As with anything, there are quirks that you may or may not experience.  Most quirks are app-related, due to app developers hard-coding absolute paths into their apps for things like temp files (Photoshop).  Strategies for resolving these sorts of quirks can be found via google.  You would probably have seen these quirks already when using server-based home folders for your kids.  If you haven't noticed them, then you're probably fine.
    The tech note you cited should be fine.  It doesn't explicitly say so, but you'll need to enable ssh on your server, at least temporarily, so you can upload your home folder to the server using scp, rsync, etc.  Don't try to copy the files up to the server via Finder.
    Once all your files are transferred to the server and in the right place, make sure to chown them on the server, so they are owned by the userID you created for yourself on the server.
    As with anything this involved, make a good backup of your laptop first.
    Note I have one user that isn't too happy with the responsiveness of the periodic mobile home syncing.  She has about a decade of e-mail in her home folder, probably 50 to 100 emails per day, many with attachments.  Mobile home syncing takes a long time to check and sync this huge tree of itty-bitty files, eevn with server-side file tracking turned on.  The other users are happy.
    The nice thing about mobile home syncing is that when a user "graduates" to an age where they've earned their own laptop, you can change them from a server home user to a mobile home user, with a minimum of fuss.  Also, if you lose or break a laptop, you can add a new replacement laptop to your network, and pull-down a replica of the home folder from the server, with almost no downtime.

  • How get the best performances with a McBook Pro 2,3GHz and 16 Go of Ram ?

    Hi,
    I've recently bought a MacBook Pro and I want to optimize my After Effects preferences to enjoy the best performances.
    There's the specifications from Apple:
    2.3GHz quad-core Intel Core i7
    Turbo Boost up to 3.5GHz
    16GB 1600MHz memory
    512GB PCIe-based flash storage
    Intel Iris Pro Graphics
    NVIDIA GeForce GT 750M
    with 2GB GDDR5 memory
    Thanks in advance if one of you could help me to do this
    Maurice

    Optimizing for performance: Adobe Premiere Pro and After Effects | After Effects region of interest

  • How do you implement basic text markup for content? H1, H2, ul, ol etc?

    Title says it all really - am I missing something?

    Thanks for that, I think I've misunderstood who the software is for?
    I'll post to the features area but if nobody was thinking about content markup during development and testing of the software, I'm not sure anyone is going to appreciate it!
    Even print designers (I have 20+ years in print and 8+ years coding) understand the importance of styles in InDesign so I'm not sure what's gained by hiding such a fundamental aspect to the internet. We're finding that our role is more about content design and less about "Website Design" per se.
    e.g. if you hid all the content on the Apple site, all you'd left with would be a bunch of lines, and light gradients - and that's true for most sites. Content truly is king.

  • I have an hp wireless d110a printer how can i get another wep key for it to set it up?

    Have a new HP d110a wireless printer how do i get or put in another key that it will take to finish setting it up to work? I need help. I had one of these before,and had to send it back, and HP sent me another one just like it. It will not take anything i put in it. How do i fix this. I went through all the steps, and it still does not take anything. Need help.

    Hi,
    Only you (or relatives) know your WEP key, it should be in your access point (AP), you can logon to it and check this out.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How to remove Sales Order to Own for multiple Batches at a time.

    Dear All,
    We use to scrap FERT materials using Mvt. Type 551 / 555, but before scrapping stocks are being removed from Sales Order using Mov. Type: 411 'E', because Batches are produced against Sales Order under MTO strategy.
    The removing process from Sales Order using T.Code MB1A & Mov. Type: 411 'E' is quite time consuming because in this case only one batch is removed from Sales Order at a time.
    So is there any way by which I can remove multiple Batches at a time from Sales Order.
    Thanks and Best Regards,
    Vivek Kumar

    Hi
    YOu can use transaction MASS with the sales document, sales document item, batch fields.
    create a variant and do the changes
    regards,
    Ramana

  • Best Performance for apex over Linux+HW RAID

    Dear Experts,
    Given:
    -- Server Specs:
    ---- HP ProLiant ML370 G6 E5540
    ---- Processor name: Intel® Xeon® E5540 (4 core, 2.53 GHz, 8MB L3, 80W)
    ---- Storage Controller: (1) Smart Array P410i/256MB
    ---- 8 SAS HardDisks with 320 GB for each
    ---- 12 GB RAM
    Required:
    1)) What are the best practice bring the best performance to Apex for the following solution stack
    ---- Oracle Linux 6.3 x86_64
    ---- Grid Infrastructure 11g R2
    ---- Database 11g R2
    ---- Oracle Apex 4.2.1
    2)) What is the best hardware RAID configuration?
    3)) What is the maximum concurrent users of applications on apex according to the above specs+software stack ?
    Regards
    Mahmoud

    Dear Alvaro
    Thank you for your response.
    The current status
    When I entered HP ACU from bootable Smart Start CD, I found under the configuration of Smart Array P410i in Embedded Slot, the following:
    -Smart Array P410i in Embedded Slot
    ---Internal Drive Cage at Port 1I : Box 1
    ------300 GB 2-Part SAS Drive at Part 1I : Box 1 : Bay 1
    ------300 GB 2-Part SAS Drive at Part 1I : Box 1 : Bay 2
    ------300 GB 2-Part SAS Drive at Part 1I : Box 1 : Bay 3
    ------300 GB 2-Part SAS Drive at Part 1I : Box 1 : Bay 4
    ---Internal Drive Cage at Port 2I : Box 1
    ------300 GB 2-Part SAS Drive at Part 2I : Box 1 : Bay 5
    ------300 GB 2-Part SAS Drive at Part 2I : Box 1 : Bay 6
    ------300 GB 2-Part SAS Drive at Part 2I : Box 1 : Bay 7
    ------300 GB 2-Part SAS Drive at Part 2I : Box 1 : Bay 8
    The questions now:
    1) Do you recommend the following configuration for RAID's logical arrays:
    Using Logical View:
    SAS Array A - 4 Logical Drive(s)
    --- Logical Drive 1 (50.0 GB, RAID 1+0) ---> for OS
    --- Logical Drive 2 (24.0 GB, RAID 0) ---> for SWAP
    --- Logical Drive 3 (200.0 GB, RAID 1+0) ---> for ASM DATA
    --- Logical Drive 4 (296.7 GB, RAID 1+0) ---> for ASM FRA
    SAS Array B - 1 Logical Drive(s)
    --- Logical Drive 5 (1.1 TB, RAID 0) ---> for non-critical applications and sources
    2) What are your recommendations for the following steps to reach oracle apex 4.2 installed?
    Best Regards
    Mahmoud

  • The best performance motherboard

    wish of all the motherboard and chipset recommend for the best performance, quality, stability for intel processors and solution for crossfire or sli?

    Msi mainboard based on P35 chipset. 

  • TS1424 WHERE ARE THE 2 SETS OF NUMBERS NEEDED TO REDEEM ITUNES GIFTCARD AND HOW DO YOU KNOW - THE WHOLE BOTTOM OF THE CARD -SET OF NUMBERS/LETTERS DO I ENTER?

    How do I redeem gift cards? What are the sets of numbers/letters located how much of them do I enter for the bottom set?

    Welcome to the Apple Community.
    The following article(s) may help you.
    iTunes Card and Gift Certificate FAQ 

  • How do I access "Firefox is NOT compatible with this application. For best performance, please use Internet Explorer 5.0 and above...." web sites; when I try to download any alternate browser, then a warning that alternate is "imcompatable with your opera

    How do I access websites that warn: "Firefox is NOT compatible with this application. For best performance, please use Internet Explorer 5.0 and above...."? When I try to download any alternate browser, all I get is another warning that the alternate is "not compatible with your operating system." Is Firefox preventing this? The site listed below is a job application site. I've had this same problem with other job application sites also.
    == URL of affected sites ==
    https://storefront.kenexa.com/lithia/cc/Home.ss

    There should be a User Agent Switcher menu item under Tools, which gives you the browser names you can impersonate.
    The menu item name changes to the browser UA you are presently using.
    There is also a User Agent Switcher button, you can add it using View -> Toolbars -> Customize, and dragging the button to your toolbar.
    See http://chrispederick.com/work/user-agent-switcher/features/ and http://chrispederick.com/work/user-agent-switcher/help/
    You can just start trying IE versions (or the versions it says on the site) until it lets you in.

  • How to connect multiple Xserve Raid for Best Performance

    I like to get an idea how to connect multiple Xserve Raid to get the best performance for FCP to do multiple stream HD.

    Again, for storage (and retrieval), FireWire 400 should be fast enough. If you are encoding video directly to the external drive, then FireWire 800 would probably be beneficial. But as long as the processing of the video is taking place on the fast internal SATA drive, and then you are storing files on the external drive, FireWire 400 should be fine.
    Instead of speculating about whether it will work well or not, you need to set it up and try your typical work flow. That is the only way you will know for sure if performance is acceptable or not.
    For Time Machine, you should use a single 1.5TB drive. It is likely that by the time your backup needs comes close to exceeding that space, you will be able to buy a 3TB (or larger) single drive for the same cost. Also, I would not trust a RAID where the interaction between the two drives is through two USB cables and a hub. If your primary storage drive fails, you need your backup to be something that is simple and reliable.
    Oh, and there should be no problem with the adapter, if you already have it and it works.
    Edit: If those two external drives came formatted for Windows, make sure you have use Disk Utility Partition tab to repartition and reformat the drive. When you select the drive in the Disk Utility sidebar, at the bottom of the screen +Partition Map Scheme+ should say *GUID Partition Table*. When you select the volume under the drive in the sidebar, Format should say *Mac OS Extended (Journaled)*.

  • How to Best Optimize Flash site for performance (not SEO)

    I am a newbie to Flash design. I have build this site for my client www.888acolyte.com
    I watched a bunch of YouTube Videos on how to stracture a site and then pulled together a lot of features from different learning resources.
    I loved Flash for its animation capabilities and used a lot of time line tweening in my site layout. My background has a moving blurry colorful spots animation, my pages come out and assemble themselves as animations, transitions and rollover done as animations.
    All of it done via Flash's time line tweening.
    As the end result site is stattering in performance rather significantly. I am not sure if it is because of the animations I have employed or because of something else?
    I used JPG instead of PNGs as they take a lesser size. I used an 80 quality in them out of Photoshop.
    Every JPG is scaled to 75% of its actual size as I expect the site to be bigger on some bigger screens. I set it up to "Allow Full screen"
    Flash Tab Settings:
    In the export options :
    JPG Quality = 80
    No Sound
    SWF Settings:
    Checked "Compress Movie"
    Checked "Include Hidden Layers"
    Checked "Include XMP Metada"
    UnChecked "Export SWC"
    HTML Tab Settings:
    Dimensions: 100%
    Quality: High
    I looked up some resources for "how to optimise a flash site"  and seems that the best one around would be from 2009: http://www.netmagazine.com/tutorials/optimise-flash-movies
    There is also this "magic button" "Save and Compact", which did not seem to have much effect on the final size of an .swf file.
    I hope to receive a feedback on how to properly stracture and optimize a Flash site for the best performance.
    If to go into details is too complicated perhaps someone can point me to a good learning resource on the topic?

    If you're just needing a flash player, have you tried the JWPlayer from Longtail Video? That's what I'm using to view flash video on my site.
    http://www.longtailvideo.com/players/jw-flv-player/

  • How to write a  SQL based on a  view can get the best performance ?

    Hi ,
        I am thinking about performance of  sql based on VIEW .<b>For the best performance ,How to do when I create  and use a view ?</b>  for example , Should i use key in my where clause as select data from table?  (of cause ,this key refers to the key of table which structure the view. ) , <b>Could you give me any advice on creating and using view in term of performance</b> ?

    Hi Guixin Chen,
    Performance depends on various factors. The major key factors are:
    1.  Result Set should be Small
    2.  Amount of Data Transferred should be minimum.
    3.  Number of Data Transfers should be minimum.
    4.  Search Overhead should be minimum.
    5.  Database Load should be minimum.
    For more details, check the following docs.
    <b>Performance Notes</b>
    http://help.sap.com/saphelp_nw04s/helpdata/en/fc/eb3b7e358411d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/5b/320c40ac368f5ce10000000a155106/frameset.htm
    You can also check Performance by,
    1.  Transaction code ST05
    2.   From ABAP Workbench using the menu path Test Performance Trace.
    Dont forget to reward pts, if it helps ;>)
    Regards,
    Rakesh.

  • How to get low performances alert for Hyper-v Host ON scom

    Hello Expert,
    We have to implement a scenario VM Live migration which involved (SCOM,SCVMM,SCORCH Parts).
    where SCOM parts  will monitor the performances of SCVMM 's Hyper-V hosts and VMs running the within the Hyper-v hosts.
    when the VMs utilization exceed the threshold and then scom monitor checks the performances of Running Hyper-v Hosts ,then using SCORCH automation ,VMs are moved to one of the best performances the Hyper-v hosts.
    To implement this ,I have integrated SCOM 2012 R2 AND SCVMM 2012 R2 AND enabled the PRO Tips.
    but don't know how to get alerts and configured related to performances of VMs and Hyper-v host.
    What will be next  needed to achieved this from SCOM PARTS.
    Thanks and Regards
    RICHA KM 

    Hi,
    In addition, hope the management pack for Hyper-v 2012 can be helpful for you, please download and import it to your management group:
    http://www.microsoft.com/en-us/download/details.aspx?id=36438
    Regards,
    Yan Li
    Regards, Yan Li

  • What's iOS is the best performance for iP4 & 3Gs

    Hi all guys here.
    How are you all guys?
    I'm new here.
    I'm now running IOS 4.1 for my both iPhone(3Gs and 4)
    But i want the new features.
    Can anyone here recommend me what the best IOS for iP3Gs and iP4? ( d best performance )
    Without battery draining or make my iphone slower.
    I'm greatly appreciate that guys.
    Trillion Thanks!!!

    Doesn't really matter, since the only iOS available for either of your phones is iOS 4.3.5, if you chose to update. Users have complained about every single iOS update since the first update for the original iPhone was released. Fact is, the vast majority of users have zero issues & happily go about their ways.

Maybe you are looking for

  • Archieve idoc

    hi all i m solving error(status 51) idoc but its posting period is closed so need to post it by archeiveing it. so plz do needful

  • How can I put in a cd in my new iMac?

    I bought the new imac and i don´t know how to put in a cd. Should I buy something or is just i´m not looking in the right side of it? Thank you

  • My background graphic dissapears after linking in IE 7!

    Just gotta love that IE! NOT! Sorry, just a little venting there. For some reason my background graphic disappears from my navigation list items after that page has been visited. This is only happening in IE. I am using IE 7. Could be happening in ot

  • Permission change timestamp

    how set permission for other user to change timestamp of file owned by me? I can set write permission via 'chmod 664 file' for any user in the same group.  Then these user can write to the file.  but they are not permitted to issue a 'touch file' com

  • Importing quick time slide shows to dreamweaver site

    I can't seem to import a mac osx quick time slide show to my web site. Anyone know how to do this?