How can I better make ctx_doc.markup for a lot/set of documents?

Hello

I'm working on a system that stores chat messages in a table where the body of the message is stored in a CLOB column. I start to implement a message text using Oracle text search and seeks to use the functionality of ctx_doc.markup to the markup for the search terms. The message table is a bit like:

(Message) CREATE TABLE

ID NUMBER (19.0),.

sender NUMBER (19.0),.

beneficiary, NUMBER (19.0),.

received_at TIMESTAMP (6).

CLOB data,

)


and we have an index of text in context on the 'data' column and 'contains' queries against it work very well. When I was looking to add capacity to the markup for the search terms, I was a little surprised that there doesn't seem to be an easy way to markup a range of results.


What I plan to do is essentially:

Start

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 can lead to hundreds of returned messages. Now in order to tag each one, I have to do a "ctx_doc.markup" for each of them, which is hundreds of times that seems horribly inefficient. Keep in mind that all this is done in a Java web service.


So my first question is, why "tagging" does not have a list of IDs to be passed to the 'textkey? That would make things much simpler as:

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');

who would then end with 4 rows with query_id 4 in the message_search_result_markup table.


Then I thought well, since I generate the code SQL in Java, I can add it as a lot of these calls in the begin/end block

Start

ctx_doc. Markup (...);

ctx_doc. Markup (...);

ctx_doc. Markup (...);

ctx_doc. Markup (...);

end

Basically, one for each message. But now I have the problem of linking a net result towards the actual message from the strong result does not store the primary key of the message that is passed as the 'textkey. If the schema of the table of restab would be something like

create the table message_search_result_markup (query_id number, varchar2, clob document textkey);


So I have a unique query_id for each request and be able to easily retrieve all results of markup and return them along with other data of the corresponding messages such as sender, recipient, timestamp, etc..


So now I think it's for each "textkey' I have, I have to create a unique query_id which is not so simple because 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 anyone have any better suggestions/ideas?


Remember I want to minimize the number of SQL queries, I have to do Java, ideally only have to do 1 query for the message, 1 search query markup messages found and 1 more request for the marked results.

You can write a function defined by the user to the ctx_doc.markup procedure, so that you can use it in a SQL query.  Please see the demo below.

Scott@orcl12c >-table data and the index to test:

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 CLOB data)

7.

Table created.

Scott@orcl12c > INSERT ALL

2 IN THE VALUES of the message (id, data)

3 (1, ' I "m work on a system that stores chat messages in a table where the body of the message)

4 stored in a CLOB column. I'm starting to implement a message using Oracle's full-text search

5 text and I want to use the functionality of ctx_doc.markup to the markup for the search terms.

6 the message table is a bit like :')

7 IN VALUES message (id, data)

8 (2, ' and we have a hint of context on queries column text and "contains" "data" against her)

9 work very well. When I was looking to add capacity to the markup for the search terms, I was a little

10 surprised that there doesn't seem to be an easy way to markup a range of results. ')

11 SELECT * FROM DUAL

12.

2 rows created.

Scott@orcl12c > CREATE INDEX message_data_idx message WE (data) INDEXTYPE IS CTXSYS. FRAMEWORK

2.

The index is created.

Scott@orcl12c >-function defined by the user to the ctx_doc.markup procedure:

Scott@orcl12c > your_markup FUNCTION to CREATE or REPLACE

2 (p_index_name IN VARCHAR2,

3 p_textkey in VARCHAR2,

4 p_text_query IN VARCHAR2,

5 p_plaintext IN DEFAULT BOOLEANTRUE,

6 p_starttag IN VARCHAR2 DEFAULT '<>

7 p_endtag IN VARCHAR2 DEFAULT ' > '.

8 p_key_type IN VARCHAR2 DEFAULT 'ROWID')

9 BACK CLOB

10 AS

11 v_clob CLOB.

BEGIN 12

13 CTX_DOC. SET_KEY_TYPE (p_key_type);

14 CTX_DOC. MARKUP

15 (index_name-online p_index_name,

16 textkey-online p_textkey,

17 text_query-online p_text_query,

18 restab-online v_clob,

19 in clear-online p_plaintext,

starttag 20-online p_starttag,

21 endtag-online p_endtag);

22 RETURN v_clob;

23 END your_markup;

24.

The function is created.

Scott@orcl12c > SHOW ERRORS

No errors.

Scott@orcl12c >-query:

Scott@orcl12c > kwic FORMAT A60 WORD_WRAPPED COLUMN

Scott@orcl12c > SELECT id,.

2 your_markup

3 ("message_data_idx",

4 ROWID,

KWIC 'column' 5)

Message 6 OF

7 WHERE CONTAINS (data, "column") > 0

8.

ID KWIC

---------- ------------------------------------------------------------

1 I'm working on a system that stores chat messages in a

table where the body of the message is

stored in a CLOB >. I started to implement a

message using Oracle full text search

Text and I try to use the ctx_doc.markup function for

the markup for the search terms.

The message table is a bit like:

2 and we have an index of text in context on the 'data' >

and "contains a" queries against it

work very well. When I was looking to add the ability to

markup for the search terms, I was a little

surprised that there doesn't seem to be an easy way to

tag a range of results.

2 selected lines.

Tags: Database

Similar Questions

  • How can I determine what my passwords for my laptop?

    My laptop passwords.

    How can I determine what my passwords for my laptop?

    I'm only guessing, but I think that it includes the administrator password, or possibly a password for the computer itself.

    I'm a bit lost here. Transmit everything you think.

    I tried changing the settings on THE ADMINISTRATOR ACCOUNT.  I tried several times but without success. I can't even to appear administrator account.

    Jeff

    Oh, a separation of thought here.  I hope you better treat that you have treated others.  I don't appreciate someone implying that I am "breaking into any computer.  Microsoft makes it easy for me..., you just made me angry.

    First of all, please cite what anyone in my message that was humiliating or derogatory.  I'll gladly apologize for it.  I am sure that you will find nothing, however.

    By reflect, if you use a method to access a PC that bypasses the password, you're violating in this computer, if it's yours.  It is a fact, but it is not an insult.  Not where I "talked down" for you.

    I also noticed that despite your not like my answer, you nevertheless marked as the answer, it is in this context.

  • How can I download the right software for my new epson perfection scanner?

    How can I download the right software for my new epson perfection 1250 scanner?  I have already downloaded TWAIN driver but that does not seem to do.  He came with a disc, I got from the thrift store.  Thank you Lydia

    Monday, February 27, 2012, 21:57:09 + 0000, lydia111111 wrote:

    How can I download the right software for my new epson perfection 1250 scanner?  I have already downloaded TWAIN driver but that does not seem to do.  He came with a disc, I got from the thrift store.

    Go to the Epson website and find the Epson perfection 1250 for
    your version of Windows. I don't know if it exists or not, but if
    for this, you will find it here.

    Whenever you switch to a new version of Windows, you must install
    drivers (software that interfaces between the hardware and)
    Windows) for printers, scanners, video cards, etc., which have been
    written for this new version of Windows.  And also note that you need
    different determinants for a 32-bit version of Windows and a 64-bit
    Version.

    It is the manufacturer of the hardware to write and
    available to download these drivers. Especially if your hardware is
    older, it is quite possible that the manufacturer has decided that it is not
    a value of his time and effort to develop drivers for the hardware that it is
    selling more.
    Check with the manufacturer or on their web site to see if a pilot
    There are. If it, download and install it. If it isn't, you're out
    lucky. Also consult their websites in other countries, if there is
    None; Sometimes you can find the driver you need in this way.

    In the future, before making such an upgrade, make sure you have
    done the appropriate research to find out what drivers do not exist,
    and so what equipment you need to replace if you upgrade.

    Ken Blake, Microsoft MVP

  • How can I get the shutter count for my Canon 7 d Mark II using Windows XP?

    How can I get the shutter count for my Canon 7 d Mark II using Windows XP? I have been looking for many places and make downloads of files, but I can't seem to find anything. I am wary of downloading software that I know nothing. Any help is greatly appreciated.

    Hi, I paid only $2.99 acquired program namely the supreme court on a 7 d Mark 2

    Search: direstudio.com to find out.

  • How can I close the Client Services for Netware that is me project to use the fast user switching without losing my internet connection

    For NetWeare customer service

    How can I close the Client Services for Netware that is me project to use the fast user switching without losing my internet connection

    Hello

    Your Windows XP question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in Forum.You IT Pro can follow the link for your question:

    http://social.technet.Microsoft.com/forums/en/category/w7itpro

  • How can I get a boot drive for windows vista

    How can I get a boot drive for windows vista

    Hello

    Here's how to do a startup, vista etc disc repair

    It is NOT a reinstall drive

    the link below is how to download and get a vista disk startup repair, which you can start from the

    http://NeoSmart.net/blog/2008/Windows-Vista-recovery-disc-download/

    Here's how to use startup repair system restore command prompt, etc. to bleepingcomputers link below

    http://www.bleepingcomputer.com/tutorials/tutorial148.html

    to boot from the dvd drive to be able to you will see a way to get into the bios Setup at the bottom of the screen or command menu start

    It would be F2 or delete etc to enter the BIOS or F12 etc. for the start menu

    Change boot order it do dvd drive 1st in the boot order

    http://helpdeskgeek.com/how-to/change-boot-order-XP-Vista/

    How to reinstall Vista

    Contact the computer manufacturer and ask them to send you to vista recovery disks to reinstall the operating system back as it was when you bought it

    they do it for a nominal cost of $

    also ask them if you have a recovery partition on your hard drive to get back to the way you bought

    you would normally press F8, F9, F10 or F11 or Alt + F10 or 0 to start to start the recovery process according to the manufacturer

    Ask them of the exact key sequence

    or borrow a vista microsoft dvd; not a HP, Acer recovery disk etc

    Make sure that you borrow the correct 32-bit or 64-bit microsoft dvd to your computer

    they contain all versions of vista

    This is the product key that determines which version of vista is installed

    http://www.theeldergeek.com/Vista/vista_clean_installation.html

    How to replace Microsoft software or hardware, order service packs and replace product manuals

    http://support.Microsoft.com/kb/326246

  • HOW CAN I FIX THE ERROR: "REGISTRATION FOR THE SERVICE IS MISSING OR DAMAGED?

    HOW CAN I FIX THE ERROR: "REGISTRATION FOR THE SERVICE IS MISSING OR DAMAGED?

    When you see this error message?

    IF its all in trying to make an update, then:

    Make sure that the following services are listed and started. in "search programs and files" type "services" (without the quotes). In the results, click on 'services' and the services window should open.

    Make sure that the following is listed and started:

    Background Intelligent Transfer Service

    The base filtering engine

    Cryptography Service

    DCOM Process Launcher service

    Remote procedure call (RPC)

    RPC end point mapper

    Windows Modules Installer

    Windows Update

    IF it's trying to make an update and the foregoing is listed and running, then try this fixit - https://support.microsoft.com/en-us/kb/971058 to see if it helps.

    PS - if one of the services above are not listed, or is listed but not start, then see if you can update your antivirus program and run a scan full to see if it detects malicious software. Then, run the fixit above.

  • How can I check my Mac mini for spyware and other viruses

    How can I check my Mac mini for software spyware and other forms of virus? Recently, I received an electronic invoice which seems to come from Apple on a purchase that I did not. Unfortunately, I answered by clicking on a link that asked me to cancel or manage this purchase that led me to a site that didn't look like an official Apple site. I am afraid that simply by doing so, I welcomed the spyware on my Mac mini hard drive.

    My Mac was purchased in 2011 and runs on OS X El Capitan (version 10.11.6).

    Kind regards

    Politkovskaya

    Receive a fraudulent e-mail for a purchase confirmation, you did not is a very common scam. Remember that you are not misled by providing personal information solicited by this e-mail.

    Unfortunately, I answered by clicking on a link that asked me to cancel or manage this purchase that led me to a site that didn't look like an official Apple site. I am afraid that simply by doing so, I welcomed the spyware on my Mac mini hard drive.

    No harm will come of the fact that you wrote. Fraudulent Web sites that are made to appear as legitimate those who are specially designed to convince you to reveal personal information. If you don't have that, no further action is necessary or justified. Do not install anything, no matter the source or the apparent popularity, in response to one such scam. To do this would be the first step in a path well worn to the misery.

    On the other hand, if you were tricked into providing personal information (like your Apple ID and password) you will need to change your password on Apple ID. Please write back for instructions.

  • How can I turn mirroring on airplay for ios10?

    How can I turn mirroring on airplay for ios10?

    Shot down at the top of any screen. Must disclose the control center, and then press with AirPlay Mirroring.

    Content how to airtime of your iPhone, iPad, or iPod touch - Apple Support

  • How can I add a separate apple for the iphone and ipad wife id

    How can I add a separate apple for the iphone and ipad wife id

    Hi, are the measures already implemented? If they are, you need to configure them again and establish a Apple ID at this time.

    Apple ID - Support official Apple

  • How can I change the default zoom for the new tab only?

    The new tab in Firefox 33 zoom is too high to see all 12 of my thumb nail. I changed it using ctrl - but the next time I opened a new tab, the zoom is 100%. How can I change the default zoom for the new tab only?

    I posted a style rule to shrink the tiles, which allows several of them on the page, but naturally reduces their legibility. You can experiment with the dimensions to find a look that works for you.

    https://userstyles.org/styles/106326/shrink-new-tab-thumbnails

    I use the Stylish extension to experiment because of its preview function that allows me to see the effect quickly. You can install it from the site of modules, then after restart of Firefox while searching for his "S" icon in the toolbar to manage Styles so you can edit and experiment.

    https://addons.Mozilla.org/firefox/addon/stylish/

  • How can I use my instore credit for a movie

    How can I use my instore credit for a movie

    Hello R Larson,

    I see that you are wanting to use a store credit for a movie. I'll be happy for you have said in the right direction. First of all, let's see if we can find out if the credit is a credit of iTunes gift card or a credit from the Apple Store. This article will help you determine what may be:

    What kind of card do I? -Apple Support

    If credit is iTunes, you can just check your balance using the instructions found in the section below and use to either rent or buy a movie to display:

    See your credit balance - Apple Support iTunes

    If the store is an Apple Store Gift card credit, you would not be able to use iTunes to watch a movie.

    I hope this helps. See you soon!

  • How can I change the background color for the bar 'help file edit view history bookmark tools' in Firefox 29,0

    How can I change the background color for the bar 'help file edit view history bookmark tools' in Firefox 29,0

    You can add a theme of solid color to change the color of the top of the browser window, which contains the Menu bar.

    https://addons.Mozilla.org/en-us/Firefox/themes/solid

  • 23 FF has a tab in the upper left corner. I made the change of url to empty, but it's still there. How can I get rid of it for good? W7 Ultimate

    F 23 has a tab box in the upper left corner. I made the change of url to empty, but it's still there. How can I get rid of it for good? W7 Ultimate. There was no box in another version of FF.

    Hello, apparently this option has been removed intentionally in preparation for a redesign of the browser which will land in firefox later this year. You can use the following extensions to work around this issue if: https://addons.mozilla.org/firefox/addon/hide-tab-bar-with-one-tab/

  • How can I get a sim card for iphone is without a carrier in order to use wifi

    How can I get a sim card for iPhone is purchased from an apple store with no carrier, I want to load the applications before signing up with someone. Help

    You can access the App Store via your Wi - Fi connection, so no date cell will be used to download apps.

    The only way to get a SIM card is a carrier.

Maybe you are looking for

  • SATA on Tecra S11 speed

    Hello I'm looking for a tecra S11 sata connection speed.I want to replace my ssd for the greater and I was wondering if I could win something when I buy a sata-600 drive instead of the sata-300 that I use at the moment.I use an OCZ vertex II now (120

  • QuickTime is not running

    I get an error message saying that «Unavailable Quicktime»

  • My dell inspiron wnt read any blank DVDs

    Reference Dell inspiron wnt play any DVD

  • PrintScreen of Windows 7 doesn't work does not correctly

    Not sure if it is in the correct category but... I downloaded Windows 7 Pro 64 - bit from my school DreamSpark account and installed on my computer, which is pretty old about 5-6 years.  There should not be anything wrong with the copy of Windows, it

  • How can I reduce the amount of RAM Java uses to 750 MB?

    Minecraft [a PC game] was running slowly, so I decided to give it more RAM. I went in the Java Control Panel and set it so that Java uses 1 GB of RAM. I went to my properties to see how much my computer's RAM, and it said I 2,00 GB [1,60 GB usable].