The research of a column with comma separated values with ora-text

I use the Oracle 11 g 2 XE and Oracle Text to a web search engine.

I've now created and text indexed a CLOB keywords column that contains words separated by spaces. This allowed me to expand the search, as Oracle Text returns the rows that have one or more keywords that are stored in this column. The contents of the column are visible to the user and serves to 'expand' the search. This does not work as expected.

But now I need support several words or even sentences. With the current configuration, Oracle Text will only search for each keyword. How should I store the phrases and configure Oracle text so that it will search entire sentences (exact match is better, but the partial match is fine too)?

Example of content column of two lines (values separated semicolon):
"Hello, Hello; y at - it anyone out there? Nope; »
"the just; basic facts; »
I found a similar question: looking for a column with values separated by commas, except that I need a solution for Oracle 11 g with it's freetext search.

Possible solutions:
1st solution: I thought to redraw the DB as follows. I would like to make a new array of keywords (pkID NUMBER, nonUniqueID NUMBER, singlePhrase VARCHAR2 (100 BYTE)). And I want to change the column previous keyword to KeywordNonUniqueID, holding the ID (instead of a list of values). At the time of the research I had INNER JOIN with the new keyword table. The problem with this solution is that I will get several lines containing the same data except for the sentence. I guess this will destroy the ranking?

2nd solution: is it possible to store sentences as an XML in the column key of origin and somehow say Oracle text to search for in the XML?

3rd solution: separate individual phrases with spaces, but replace the spaces in sentences with the underscore or something (making a single word). If a phrase "why Hello there, Johnny!" is saved as "Why_hello_there, _Johnny!

4th solution?:

Note that, generally, there is a lot of sentences (less than 100), nor that they will be long (one sentence will be up to 5 words).

Also note that I am currently using CONTAINS, and needs some of its operators, to my full-text searches.

When you talk about "phrase", do you mean "a list of words separated by a comma other sentences?

Isn't that the definition of "sentence" used by Oracle Text, where it simply means "a list of words in the order defined."

If I understand your requirement, you want to have data such as:

"aa bb cc dd".
"aa ee dd ff.

and give priority to the first on the second if someone looking for "dd".

First, to conduct research in the comma separated list, you should look for in a section. You can either explicitly define sections of field such as
AA bb cc dd
Or you can use the PHRASE special section and set the sentence delimiters correctly. This is done with the attribute BASIC_LEXER punctuation

Then you have the number you want to find only words where they are the only words in the section. That's the same problem, I address in the last post of this forum entry:
Contains: match exactly

Our solution will be substantially the same, some surrounding text with special markers, and then prioritize a phrase search with these special markers each side of the word.
We need to do a treatment some additional, although, as we need to surround each "sentence" (in your terminology) with special markers. I did it by surrounding the text with "XX1"... Condition2"then by replacing every comma with"Condition2, XX1"as part of a MULTI_COLUMN_DATASTORE:

drop table names;
create table names (id number primary key, text varchar2(50));

insert into names values( 1, 'just and kind, kind and loving' );
insert into names values( 2, 'just, kind' );

exec ctx_ddl.drop_preference  ( 'mylex' )
exec ctx_ddl.create_preference( 'mylex', 'BASIC_LEXER' )
exec ctx_ddl.set_attribute    ( 'mylex', 'PUNCTUATIONS', ',' )

exec ctx_ddl.drop_preference  ( 'mcds' )
exec ctx_ddl.create_preference( 'mcds',  'MULTI_COLUMN_DATASTORE' )
exec ctx_ddl.set_attribute    ( 'mcds', 'COLUMNS', '''XX1 ''||replace(text, '','',''XX2, XX1'')||'' XX2''' )

exec ctx_ddl.drop_preference  ( 'mywl' )
exec ctx_ddl.create_preference( 'mywl', 'BASIC_WORDLIST' )
exec ctx_ddl.set_attribute    ( 'mywl', 'SUBSTRING_INDEX', 'YES' )

create index namesindex on names(text)
indextype is ctxsys.context
parameters( 'datastore mcds wordlist mywl' )
/

select score(1),id,text from names where contains( text, '

  
    
       XX1 kind XX2 
       kind
    
  

', 1) > 0
order by score(1) desc
/

Output of this is:

  SCORE(1)        ID TEXT
---------- ---------- --------------------------------------------------
     52         2 just, kind
      2         1 just and kind, kind and loving

Tags: Database

Similar Questions

  • Order with comma separated values?

    I have the following table

    create table ord as
    (select col1 '4,7,10'
    Union
    "4,7,8'."
    Union
    '5,6,11'
    Union
    '4,7,10'
    Union
    '4,7,6'
    Union
    '4,7,7'
    the double)

    I mean select * from DSB order by col1 and the by should look at every number in the column ordering him to string vs...
    Currently 4,7,10 comes first (as it is a string comparison), but I want to come 4,7,6 first.

    It could by urgent for you, but it is not, we have our own work to do.

    In any case...

    It will focus on any number of numbers in the list up to 10 digits long each...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with ord as
      2  (select '4,7,10' col1 from dual union
      3   select '4,7,8' from dual union
      4   select '5,6,11' from dual union
      5   select '4,7,10' from dual union
      6   select '4,7,99,4' from dual union
      7   select '4,7,6' from dual union
      8   select '4,7,7' from dual)
      9  -- End of test data
     10  select col1
     11  from ord
     12* order by regexp_replace(regexp_replace(col1,'(^|,)([^,]+)','\1000000000\2'),'(^|,)[^,]*([0-9]{10})(,|$)','\1\2\3')
    SQL> /
    
    COL1
    --------
    4,7,6
    4,7,7
    4,7,8
    4,7,10
    4,7,99,4
    5,6,11
    
    6 rows selected.
    
    SQL>
    

    If you need to more digits cos you're numbers are bigger, so you need to change the regular expression to pad with more than 0 (inbetween the \2 \1) and cut to the required length or replace the {noformat} {10} {noformat} with the number of digits required.

  • How to make the sum of numeric fields based on a value in a text field - charge memo

    I'm working on a Weekly Report of expenses employee that contains a list of charges and each can be marked as a company or a paid employee costs.  There are two fields in the form which is to show totals for the company and the employee paid expenses.  There are seven columns for amounts, one for each day of the week.  Expense Code text fields are called "Exp1" through "Exp7".  Digital type amount fields are called 'Amount1' by 'Amount7.  The fields under each column share the same name.  (Hope that makes sense).  A screenshot is below, and a link to the form is included in order to better understand the composition of the form.  I don't know how to for a total of to the top of all expenditures that are marked with a 'C' and all those marked with an "E".  I'm not well versed in Java.  Any suggestions would be greatly appreciated!  Thank you!!

    Link to the form:

    https://www.dropbox.com/s/sgsle5bkam2y4am/expense%20Report%20v1_0%20-%20LC%20Original.PDF? DL = 0

    Expenses.jpg

    I tried to implement your requirement in the form at the following link. If please test and let me know if it works.

    https://www.dropbox.com/s/v4n9kypdnplc857/expense%20Report%20v1_0%20-%20LC%20Original_V1.p df? DL = 0

  • The research of Web applications with fields of the Data Source that contains multiple values

    I have a Web application with a field that allows multiple values to be recorded similar to the list box. I need limit the allowed values for a large, over the list of the values currently stored in another Web application as a data source. I can not apply to the type of Data Source field that allows only single value selection. I also need to be able to use the search form Web App to search for items containing 1 OR more of the values in this field (a type of list control field search functionality). Here's what I tried to field types:

    • Text (String) or text (multi-line) field type - By saving a list of values separated by commas (outputs in the same way this list box) to an entry of text or textarea, the search only logic search exact string (including commas) and does not analyze individual values.
    • Type of list (checkbox) field - it allows me to search for multiple values using the logic of the GOLD, but the web application stores only the values that have been entered as an option in the field settings real web app. I tried to use a checkbox with minimal or empty options list, hoping that some values I sent more separate by a comma value chain would be still stored, but because the values come from my Web App data source and not stored with the field options list, they were not saved.

    Someone at - he found a way to do it?

    My other question is how can I use a multivalued field to similar as described above but return results containing the elements with ALL the values of this field (AND logic).

    Can someone enlighten me to the inner workings of the search BC logic web app?

    You don't need to use the predefined boxes or types of entries. Everything you can represent as a string (such as the values separated by commas in your example) can be saved in any field of webapp. The types of fields defined in the Web application are only used to translate internal representation (all channels) to the various user-friendly interpretations (checkboxes, radios, dates, links, etc.)

  • The sum of a column with 2 values using Forms 6i

    Hello world
    I have 2 blocks, a main block and the other is
    my block of retail and my block of retail element is a list item
    When I have 2 options to choose, we're for described video and the
    Another is for delay.
    My question is:
    How can I add an item in my form where I will summarize the
    amount of A and L is inserted on this column?

    I forgot about it. DECODE cannot be used in SQL. This time I tried the solution myself in Forms 6i, so I know it works. Set the formulas

    InStr(:Item,'A')

    This returns 1 if the value is A, 0 otherwise. Ditto for the L value of course.

  • How do the sum of several columns with grouping different criteria

    Currently I am doing a project where I needed to generate the report which retrieved from the table. the table as shown below

    CURRENCY_A AMOUNT_A CURRENCY_B AMOUNT_B CURRENCY_C AMOUNT_C

    USD 100 EURO 100 POUNDS 100

    EURO 200 BOOKS 200 200 USD

    BOOKS USD EURO 300 300 300

    My expectations is the grand total of the Group (AMOUNT_A + AMOUNT_B + AMOUNT_C) currency

    USD:

    EURO:

    BOOKS:

    Is it possible to do this output in oracle alone?

    Hello

    UNPIVOT before consolidation / summary:

    SELECT currency, flat

    DE)

    SELECT CASE WHEN 1 THEN currency_a n

    WHEN 2 THEN currency_b

    WHEN 3 currency currency_c end THEN

    CASE WHEN 1 THEN amount_a

    WHEN 2 THEN amount_b

    WHEN 3 amount of end of amount_c THEN

    From your_table

    CROSS JOIN (select column_value table n (sys.odcinumberlist (1,2,3))) t

    )

    GROUP BY currency

  • Using 'text field contains comma-separated values' on a parameter of %

    Hello

    I use a parameter that has more than one value to be entered, separated by commas. I checked the box 'text field contains values separated by commas' for the parameter and set the sql code by using the operator 'in' so that the column will look in the multiple input values (e.g. family name in (: surname_par)). However, as passing multiple values parameter must also be able to manage %'s. As the sql uses the 'in' operator, BI Publisher brings back an error because % is supposed to bring all family names and not people with a last name of %. Is there a way to get around this?

    Thank you

    If you try to pass multiple values separated by commas and in addition also takes the query to return the data when the user types just in '%', then you could write something like this in your query:

    Select * from table_name
    where ((1 = DECODE (: surname_par, '%', 1, 0)) OR family name in (: surname_par))

    I hope this helps. Please award points if helpful/correct.

  • creation of selection using comma-separated values list

    Hi all

    I have the column in the database containing values separated by commas
    for ex: Pune, Mumbai, Bangalore...

    I want to create the selection list using higher values.
    for ex: Pune
    Mumbai
    Bangalore


    Please help me on this issue.

    Thanks in advance,
    Jitendra

    Hello

    Try the following

    select regexp_substr(YOUR_FIELD_NAME,'[^,]+', 1, level) display_value,
           regexp_substr(YOUR_FIELD_NAME,'[^,]+', 1, level) return_value
      from YOUR_TABLE
      connect by regexp_substr(YOUR_FIELD_NAME, '[^,]+', 1, level) is not null
    

    Concerning

    Graham

    Published by: gpc on February 1, 2012 11:27

  • Comma Separated Values

    Hello
    We stock values separated by commas into a table.


    IIL_CUSTOMER_TICKETS_TYPE_IDS
    -------------------------------------------------------
    1,2,3,4,5,6
    5,7,10,56,48
    12,45,56,

    I want to query this table through values separated by commas...

    Query as this select * from t1 where IIL_CUSTOMER_TICKETS_TYPE_IDS in (1,2,3)

    Help, please...

    Try this

    with mytable as
    (
    Select 'a' pass, ' 1,2,3,4,5,6"txt of all double union
    Select 'b', '5,7,10,56,48' of any double union
    Select 'c', "12,45,56" of the double
    )
    Select
    MyTable.col,
    txt
    Of
    MyTable,
    (
    Select
    level n
    Of
    (
    Select
    Max (length (txt) - length (replace (txt, ','))) as max_commas
    Of
    MyTable
    )
    connect by level<= 1="" +="">
    ) ctr
    where
    CTR.n<= 1="" +="" length="" (txt)="" -="" length="" (replace="" (txt,="">
    and regexp_substr (mytable.txt, "[^,] +', 1, n") in (1,5,7)
    order by
    MyTable.col,
    CTR.n

    http://nimishgarg.blogspot.com/2010/06/Oracle-comma-seprated-string-to-rows_16.html

    Alexander gelin
    http://nimishgarg.blogspot.com

  • How can I change the background in the tabs open; currently grey with black text difficult to read.

    Can I change the background color of tabs open in FF 4.0. Currently, it is grey with black characters. A clear background would be easier to read.

    Thank you, TJH

    Download this addon: https://addons.mozilla.org/en-us/firefox/addon/stratiform/ it allows you to change the color of tabs, as well as many other options.

  • Multiple failures for the new certificates of trust with ORA-28857

    We are seeing problems with the work of the API using UTL_HTTP on SSL start to fail with the new approved certificates. Just import these certificates in the portfolio results in a ORA-28857 and a corrupt portfolio. We use 11.2.0.1.  3 channels of trust do not now have. Include cert (fire hydrant and godaddy certs) chains of


    https://API.Betfair.com

    https://www.FlipKey.com/

    I had a support call open for the last month with no resolution.

    If anyone has the possibilities of solutions / solutions might just save me a few sleepless nights. The feature of our products is dying because of this problem!


    If the certificates are SHA2, they will not work in 11201... they are entirely supported 11203 upward.

  • Make the same comp several times with different text

    Hello!

    I'm looking for a way to make my 100 + times with a different text in two layers. I thought batch replicate this model and then batch change text layers, but I've been Googling autour and found no solutions.

    I need is ready solution, just a direction on an approach I take to perform this task. Told me on another forum to ask here and there are a few scripts that are just what I need assistance excellent file as data. You could point me to them?

    Thank you!

    This is an old thread from Creative Cow that deals with a way to do what you want using a file text and Expressions:

    CreativeCOW

    There are also some commercial script tools that automate the process very well:

    CompsFromSpreadsheet 5 - aescripts + aeplugins - aescripts.com

    Templater - aescripts + aeplugins - Rig aescripts.com

  • Comma Separated Values in Bind Variable

    Hello

    I'm on Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production.I use in query
    select * from employees where first_name in ('Ajay','Ajay5')
    It gives me two rows as it should. Now, I want to pass these values as a bind variable.
    select * from employees where first_name in :1
    Now when I run the query and make its contribution as a ('Ajay', 'Ajay5'). It gives me no line.

    Is their any way to do this. Let me know if you have any questions

    Thank you
    AJ

    Check out this link: the Blog of Tom Kyte: varying in lists...

  • The search for Clob columns in interactive report

    I use APEX 3.2 with 10g. I have an interactive report with a query that takes several recordings of 'comments' and the concatenates using a function that returns a Clob. In the report, there are several of these comments columns mixed with some small varchar2 columns.

    Using the search bar, if I type in a Word and click OK, it does not seek my Clob columns. On the other hand, I can use the drop-down list in the search bar to indicate I want to only search one of these Clob columns, then the research works.

    Is there a reason that my filters 'Text line contains' do not include my Clob columns? I have defined, as the "Standard report column" and they all "filter" checked as a permitted operation.

    Greg

    I found a work around for this problem. IR reports do not seem to automatically search for CLOB columns as a search ROWTEXT (unless you are specifically targeting this column). So, I wrapped the CLOB column with:

    DBMS_LOB.substr(clob_column_name,4000,1)

    This converts the CLOB Varchar2 column, which made the report «see» IR Of course, this only works if you want to search for the first 4000 bytes, but the data in my CLOB columns are never more than a few sentences long.

  • In DataGrid, how to fill a column with zeros (0) records?

    Is there a simple way, in a DataGrid, for fill the records in a column with zeros (0)?

    I have a DataGrid with two columns: colA and colB.  ColA records values from a RemoteObject call.  I need auto-fill (AutoFill) recordings in colB with zeros.  How is that possible?

    Thank you!

    If you need to 0 in the dataprovider, once pass you the loop of result of the data provider and add a dynamic property with value = 0;

    Something like that

    var dp:ArrayCollection = event.result as ArrayCollection collection;

    for (each var item: Object in PD)
    {
    item.demoValue = 0;
    }

    Create a new datagrid column, set demoValue as datafield.

    If it is just for display, add a new column, put an itemrenderer with label = '0 '.

Maybe you are looking for