Weighting the results of a text search

I have an application that is using Oracle Text to search the database for similar customer names. What I am trying to do is give the developers a result-set with the most relavent matches listed first, but I cannot figure out how to score/weight the results.
Example:
Here is my query:
select * from operator z
where contains
(concat,'hilton hotel within {the_operator_name}',1 ) > 0
It returns the following records in order:
OPERATOR_ID OPERATOR_NAME
1000084 Hilton Hotel
1001397 HILTON HOTEL AIRPORT
1001472 Hilton Hotel & Conference Ctr.
1004356 Hilton Hotel/Avendra Eugene
1005660 Hilton Hotel
I would like both "Hilton Hotel" results (the first and last in the list) to return before any of the other results, as these are a perfect match and are most likely to be picked by the user.
Thanks in advance.

I can't tell from what you provided, what type of datastore or section group you have. So, here is another example that uses a different type of datastore and different type of section group, but it really doesn't matter what you are using as the ordering by utl_match.edit_distance is the same.
SCOTT@orcl_11g> CREATE TABLE operator
  2    (operator_id   NUMBER,
  3       operator_name VARCHAR2 (60),
  4       concat           VARCHAR2 (1))
  5  /
Table created.
SCOTT@orcl_11g> SET DEFINE OFF SCAN OFF
SCOTT@orcl_11g> INSERT ALL
  2  INTO operator VALUES (1000084, 'Hilton Hotel', NULL)
  3  INTO operator VALUES (1001397, 'HILTON HOTEL AIRPORT', NULL)
  4  INTO operator VALUES (1001472, 'Hilton Hotel & Conference Ctr.', NULL)
  5  INTO operator VALUES (1004356, 'Hilton Hotel/Avendra Eugene', NULL)
  6  INTO operator VALUES (1005660, 'Hilton Hotel', NULL)
  7  INTO operator VALUES (9999999, 'some other operator name', NULL)
  8  SELECT * FROM DUAL
  9  /
6 rows created.
SCOTT@orcl_11g> CREATE OR REPLACE PROCEDURE concat_proc
  2    (p_rowid IN           ROWID,
  3       p_clob     IN OUT NOCOPY CLOB)
  4  AS
  5  BEGIN
  6    FOR r IN (SELECT * FROM operator WHERE ROWID = p_rowid) LOOP
  7        DBMS_LOB.WRITEAPPEND (p_clob, 17, '<the_operator_id>');
  8        DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r.operator_id), r.operator_id);
  9        DBMS_LOB.WRITEAPPEND (p_clob, 18, '</the_operator_id>');
10        DBMS_LOB.WRITEAPPEND (p_clob, 19, '<the_operator_name>');
11        DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r.operator_name), r.operator_name);
12        DBMS_LOB.WRITEAPPEND (p_clob, 20, '</the_operator_name>');
13    END LOOP;
14  END concat_proc;
15  /
Procedure created.
SCOTT@orcl_11g> SHOW ERRORS
No errors.
SCOTT@orcl_11g> EXEC CTX_DDL.CREATE_PREFERENCE ('your_datastore', 'USER_DATASTORE')
PL/SQL procedure successfully completed.
SCOTT@orcl_11g> EXEC CTX_DDL.SET_ATTRIBUTE ('your_datastore', 'PROCEDURE', 'concat_proc')
PL/SQL procedure successfully completed.
SCOTT@orcl_11g> CREATE INDEX your_index ON operator (concat)
  2  INDEXTYPE IS CTXSYS.CONTEXT
  3  PARAMETERS
  4    ('DATASTORE     your_datastore
  5        SECTION GROUP CTXSYS.AUTO_SECTION_GROUP')
  6  /
Index created.
SCOTT@orcl_11g> COLUMN concat NOPRINT
SCOTT@orcl_11g> COLUMN operator_name FORMAT A30
SCOTT@orcl_11g> -- original query:
SCOTT@orcl_11g> select * from operator z
  2  where contains
  3  (concat,'hilton hotel within {the_operator_name}',1 ) > 0
  4  /
OPERATOR_ID OPERATOR_NAME
    1000084 Hilton Hotel
    1001397 HILTON HOTEL AIRPORT
    1001472 Hilton Hotel & Conference Ctr.
    1004356 Hilton Hotel/Avendra Eugene
    1005660 Hilton Hotel
SCOTT@orcl_11g> -- ordering by utl_match.edit_distance:
SCOTT@orcl_11g> select z.*,  UTL_MATCH.EDIT_DISTANCE ('hilton hotel', LOWER (operator_name)) edit_dist
  2  from   operator z
  3  where contains (concat,'hilton hotel within {the_operator_name}',1 ) > 0
  4  ORDER BY edit_dist
  5  /
OPERATOR_ID OPERATOR_NAME                   EDIT_DIST
    1000084 Hilton Hotel                            0
    1005660 Hilton Hotel                            0
    1001397 HILTON HOTEL AIRPORT                    8
    1004356 Hilton Hotel/Avendra Eugene            15
    1001472 Hilton Hotel & Conference Ctr.         18
SCOTT@orcl_11g> -- ordering by utl_match.edit_distance_similarity:
SCOTT@orcl_11g> select z.*,  UTL_MATCH.EDIT_DISTANCE_SIMILARITY ('hilton hotel', LOWER (operator_name)) edit_dist_sim
  2  from   operator z
  3  where contains (concat,'hilton hotel within {the_operator_name}',1 ) > 0
  4  ORDER BY edit_dist_sim DESC
  5  /
OPERATOR_ID OPERATOR_NAME                  EDIT_DIST_SIM
    1000084 Hilton Hotel                             100
    1005660 Hilton Hotel                             100
    1001397 HILTON HOTEL AIRPORT                      60
    1004356 Hilton Hotel/Avendra Eugene               45
    1001472 Hilton Hotel & Conference Ctr.            40
SCOTT@orcl_11g> -- ordering without selecting the column:
SCOTT@orcl_11g> select * from operator z
  2  where contains (concat,'hilton hotel within {the_operator_name}',1 ) > 0
  3  ORDER BY UTL_MATCH.EDIT_DISTANCE ('hilton hotel', LOWER (operator_name))
  4  /
OPERATOR_ID OPERATOR_NAME
    1000084 Hilton Hotel
    1005660 Hilton Hotel
    1001397 HILTON HOTEL AIRPORT
    1004356 Hilton Hotel/Avendra Eugene
    1001472 Hilton Hotel & Conference Ctr.
SCOTT@orcl_11g> select * from operator z
  2  where contains (concat,'hilton hotel within {the_operator_name}',1 ) > 0
  3  ORDER BY UTL_MATCH.EDIT_DISTANCE_SIMILARITY ('hilton hotel', LOWER (operator_name)) DESC
  4  /
OPERATOR_ID OPERATOR_NAME
    1000084 Hilton Hotel
    1005660 Hilton Hotel
    1001397 HILTON HOTEL AIRPORT
    1004356 Hilton Hotel/Avendra Eugene
    1001472 Hilton Hotel & Conference Ctr.
SCOTT@orcl_11g>

Similar Messages

  • When at the "results" page of a search, clicking on "blue" link does not display webpage. Copying "green" urldoes.

    When at the "results" page of a search, clicking on "blue" link does not display webpage although url is shown in address bar. Copying "green" url, shown at bottom of a result, into address bar and hitting "enter" goes to the address and displays the page. Have tried different selections at tools/options with no change. Is there some other setting that needs to be changed?

    Sorry, this is bad reply. I wanted to write this reply to another question.

  • Saving the result set in a Search page

    Hi ,
    We have a manual search page where the results are displayed in the form of 10 columns. The first 5 are read only fields whereas rest 5 are editable checkboxes.
    There is no Query region created in our page.
    Suppose, fields a, b, c are search parameters and the results are as :
    | A | B | C| D |E | F | G | H | I | J |
    1
    2
    3
    4
    5
    6
    7
    7 records are retrieved. Columns A to E are read only text fields whereas columns F to J are check boxes. The user can update the checkboxes.  We have a Save button below the result set region. This button on being pressed invokes a stored PL/SQL Procedure which does some validations on the result set so obtained.
    Our requirement is to dump all the 7 records (after the modifications are made to any number of result records) into a temporary table . The procedure will then pick the records from this temporary table and do the required validations.
    Question is :
    1. How to store the result set so obtained into a table after some (or all) records are modified once Save is pressed ?
    We do not have any EO created in our page. The VO for obtaining the Result set is a combination of many tables.
    Any help would be greatly appreciated.
    Thanks,
    Neha

    River_Plate wrote:
    root cause
    java.lang.NullPointerException
    org.apache.jsp.tablasUF_jsp._jspService(tablasUF_jsp.java:68)Do you understand anyway when a NullPointerException would be thrown? Those kind of RuntimeExceptions are basic Java knowledge.
    If an object is null while you want to access it, then a NPE would be thrown. Check the line of the cause which objects could be null and fix it accordingly.

  • How to merge text files and put the result in a text file.

    Hi,
    I am trying to merge the files(text) using OWB and I would like to put the result in a file. Could any one please explain how to do this.
    Thanks and regards
    Gowtham Sen.

    using the unix commnad 'cat' along with the redirect '>>' will concat the files into one target
    #this will create the target file and over-write it if it existed already
    cat file1 > target
    ##Now add the rest of the files to the target, without over-writing
    cat file2 >>target
    cat file3 >>target
    cat file16 >> target
    You can then use an external table on the target file.
    A nicer way would be to user a 'for loop', but this will work fine.

  • How do I get the results of 2 text fields and put the output into another ?

    I have 2 text fields that multiply off of each other.
    My question is, is there a way to get the result of this and put it into another text field? And from that result get another result? Or do I have to get the results from a textarea?

    I have 2 text fields that multiply off of each other.I assume this really means you want to have something else multiply the contents of the two text fields. When you are using an object-oriented language, it is helpful if you consider what objects are responsible for what actions. Loose descriptions lead to confusion.
    My question is, is there a way to get the result of
    this and put it into another text field? And from
    that result get another result? Or do I have to get
    the results from a textarea?Assuming that your "text field" is a Swing text component (and not, say, an HTML text field) then it has a getText() method that returns the contents as a String. If you plan to multiply this by something then you'll want to convert it to an int or a double or maybe a BigInteger or a BigDecimal object. Are we on the right track here?

  • How to display the result of  Intermedia  text in html

    After defining the following statments:
    begin
    ctx_ddl.create_preference('COMMON_DIR','FILE_DATASTORE');
    ctx_ddl.set_attribute('COMMON_DIR','PATH','c:\temp');
    ctx_ddl.create_section_group('XML_GROUP','xml_section_group');
    ctx_ddl.add_zone_section('XML_GROUP', 'Order', 'Order');
    ctx_ddl.add_zone_section('XML_GROUP', 'currencyType', 'currencyType');
    create index myindex on xmltable(xml_text)
    indextype is ctxsys.context
    parameters ('datastore COMMON_DIR section group XML_GROUP');
    end;
    then I run the following SQL statement:
    select id,xmltext from xmltable
    where contains(xmltext,'156 within currencyType')>0;
    by the way the table xmltable is defined as :
    create table xmltable(id number primary key,xmltext CLOB);
    Now I want to display the querying result in html ,what should I do???

    If the query returns all of the information you require and it is (as the data model would suggest) in XML format, the obvious choice is to use an XSLT Style Sheet to render the XML data to a HTML document.
    There is plenty of information on XML and XSLT in the standard Oracle documentation but be warned, whilst XSLT is a reasonably well defined standard, it is a little complex and can take time to get used to. You will find a lot of books available on the subject.
    Dean

  • How to display additional fields in the results a 'search user'?

    This may be a newb question but how can I display additional user attributes in the results of a user search in the admin console?
    i.e. more than just the standard fields of: User ID, First Name, Last Name, Status, Enable, Disable, Unlock and Delete.
    I would like to include some UDFs that I have defined for the create user form e.g. personnel number.
    Thanks,
    Bernie

    Thats not gonna work for sure. Thats to include additional attributes in the search input parameters drop-down. There is another procedure to do that, but not very sure if it works or not because once I was decompiling the code and found that it doesn't have an implementation. You can anyway try it out, the worst would be that you would not be able to see the column headings, but try atleast:
    And thats through the use of properties file. Open up ** and search for the following section-
    *#global.request.users.selectedListDisplayFields=*
    *#global.request.users.selectedListDisplayFields.lables=*
    Remove the comments and update it to below-
    global.request.users.selectedListDisplayFields=USR_UDF_EMPID
    global.request.users.selectedListDisplayFields.lables=global.xmlmetadata.users.USR_UDF_EMPID
    where USR_UDF_EMPID is the UDF and global.xmlmetadata.users.USR_UDF_EMPID is its associated translation.
    Thanks
    Sunny

  • SQL Server Free Text Search with multiple search words inside a stored procedure

    I am trying to do a free text search. basically the search string is being sent to a stored procedure where it executes the free text search and returns the result.
    If I search for red
    flag, I want to return the results that matches both red and flag text.
    Below is the query I use to return the results.
    select * from customer where FREETEXT (*, '"RED" and "flag"')
    This doesn't give me the desired result. Instead this one give the desired result.
    select * from customer where FREETEXT (*, 'RED') AND FREETEXT (, 'FLAG')
    My problem is since it's inside a stored procedure, I will not be able to create the second query where clause. I thought both query should return the same result. Am I doing something wrong here?

    I am moving it to Search.
    Kalman Toth Database & OLAP Architect
    IPAD SELECT Query Video Tutorial 3.5 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Clarifications needed for full text search

    Hi,
    I need some clarification regarding full text search.
    1) Is japanese part of the standard Oracle full text search?
    2) if it is not, how to install the japanese lexer?
    3) how oracle is sorting international characters. If a column contains both english, japanese and french, how will be the output?
    Thanks
    Muneer

    Follwoing is the sql statement and the result i got
    select language, description,lengthb(description) bytes, length(description) length, vsize(description) vsize from t2;
    LANGUAGE      DESCRIPTION      BYTES      LENGTH      VSIZE
    English      abcdefghij      10      10      10
    English      zyxwvutsrq      10      10      10
    French      désignéess      16      12      16
    French      réconcilia      13      11      13
    German      Einfuhrzöl      13      11      13
    German      müßtämpfer      19      13      19
    Greek      Î´Î·Î¼Î¿ÏƒÎ¹Î¿Î³ÏÎ±      40      20      40
    Greek      Î±Ï€Î¿ÎºÎ»ÎµÎ¹ÏƒÏ„ι      42      20      42
    Russian      Ð¿Ñ€ÐµÑÑ‚упник      42      20      42
    Russian      Ð¿Ñ€Ð¸Ð²ÐµÐ´ÐµÐ½Ð¸Ñ      41      20      41
    Japanese      å…¥é–“市の会社の銀行口      65      30      65
    Japanese      ç¥žæˆ¸å¸‚ä¸å¤®åŒºã®æ±éŠåœ’      62      30      62
    Korean      ì¶œë°œì ë¶€í„°ì¶œë°œì ë¶€í„°      64      30      64
    Korean      ë³´ì¢Œê´€ì„출발점부터경      64      30      64
    Hindi      à¤•à¤¤à¤œà¤¨à¤¤à¤®à¤¨à¤œà¤¤à¤¶à¥à¤°      73      36      73
    Hindi      à¤¨à¥€à¤šà¥‡à¤¨à¥€à¤šà¥‡à¤¨à¥€à¤šà¥‡à¤¨à¥€à¤šà¥‡à¤¨à¥€à¤šà¥‡      130      60      130 I think it explains a lot. I am facing another problem in searching blob columns when it contains japanese or korean characters. I tried with multi lexer (adding japanese as sub lexer and making english as default lexer). But it is not searching the column. Do i have to set any other parameters (editing registry, changing enviornment setting etc). I used the following script to set the lexer.
    begin
         ctx_ddl.create_preference('english_lexer','basic_lexer');
         ctx_ddl.set_attribute('english_lexer','index_themes','yes');
         ctx_ddl.set_attribute('english_lexer','theme_language','english');
         ctx_ddl.create_preference('german_lexer','basic_lexer');
         ctx_ddl.set_attribute('german_lexer','composite','german');
         ctx_ddl.set_attribute('german_lexer','mixed_case','yes');
         ctx_ddl.set_attribute('german_lexer','alternate_spelling','german');
         ctx_ddl.create_preference('japanese_lexer','japanese_vgram_lexer');
         ctx_ddl.create_preference('korean_lexer','KOREAN_MORPH_LEXER');
         ctx_ddl.set_attribute('korean_lexer','COMPOSITE','NGRAM');
         ctx_ddl.create_preference('global_lexer', 'multi_lexer');
         ctx_ddl.add_sub_lexer('global_lexer','default','english_lexer');
         ctx_ddl.add_sub_lexer('global_lexer','german','german_lexer','ger');
         ctx_ddl.add_sub_lexer('global_lexer','japanese','japanese_lexer','jpn');
         ctx_ddl.add_sub_lexer('global_lexer','korean','Korean_lexer');
    end;Hope i presented enough details.

  • Filter the results set for custom iviews in SAP MDM

    We have a scenario where based on the user name/user role we want to filter the results retrieved by an search result iview developed for accessing data from SAP MDM Repository.
    E.g.
    We have a lookup table called Plants which contains master data pertaining to  manufacturing plants.
    The portal user P00100xxyy is responsible for maintaining master data for a plant 1101. However, the plant lookup contains data for other plants as well.
    We would like to prevent the user P00100xxyy to see/modify data for other plants in the table.
    We have explored the core MDM functionality of security/constraints. It does not provide row level granularity and we are hoping that the iview approach can help us achieve row level filters.

    Hi Rajni thanx for ur prompt reply
    The actual problem is that :
    we have approx near about 100 Account Group, so it would become very complex to replicate same condition 100 times
    AND
    these account group may keep on increasing so even maintenance point of view it would be hard to maintain.
    can u tell me some other way to do it, i mean is there any other feature by which we can perform validation in MDM.
    Regards
    Kuldeep

  • Why does the location bar only perform searches, even typing about:config just returns a google search for "about:config"

    My location bar will only perform web searches and no longer takes the browser directly to web address entered manually. for example typing "about:config" returns the results of a google search for "about:config", typing "http://www.gawker.com" does not take me to gawkers website but rather returns google search results for "http://www.gawker.com".

    ''You might want to disable or remove that Yahoo! activeX Plug-in Bridge that shows in your Installed Plugins. Firefox doesn't do ActiveX and a plugin like that might leave you open to being exploited.''
    First you need to figure out if an extension you have installed is causing that.
    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]
    Or, it could be caused by Malware.
    Install, update, and run these programs in this order. '''''(Not all programs detect the same Malware.)''''' They are all free for personal use, but some have limited functionality in the "free mode" - but those are features you really don't need to find and remove the problem that you have.<br />
    ''Note: If your Malware infection is bad enough and you are mis-directed to URL's other than what is posted, you may have to use a different PC to download these programs and use a USB stick to transfer them to the afflicted PC.''
    Malwarebytes' Anti-Malware - [http://www.malwarebytes.org/mbam.php] <br />
    SuperAntispyware - [http://www.superantispyware.com/] <br />
    AdAware - [http://www.lavasoftusa.com/software/adaware/] <br />
    Spybot Search & Destroy - [http://www.safer-networking.org/en/index.html]
    Or maybe your ISP is doing the redirect, but that is doubtful since you're getting two different redirect addresses (unless you are using two different ISP's).
    There are two extensions that can prevent redirects: <br />
    NoRedirect: <br />
    https://addons.mozilla.org/en-US/firefox/addon/11787/
    Redirect Remover: <br />
    https://addons.mozilla.org/en-US/firefox/addon/537/

  • Oracle portal text search and bespoke table

    We have the oracle portal text searching working okay.
    We also have a bespoke table that users are uploading word documents into a blob column.
    Is it possible to get oracle portal text searching to search this bespoke table as well. Maybe by creating an index that points at this table or
    when a document is uploaded an api call that registers the document in oracle text searching??????

    The oracle Portal text is created for content that can directly be mapped to items, folders etc on portal. The BLOB column you want to indexed has not been mapped to content uploaded in portal.
    You might want to explore crawling using the Ultrasearch table datasource for the same

  • Send the result of a query by email

    Hi,
    I want to execute a query in a procedure and send the result in an email using the utl_smtp package. I have send a one line messages based on the result received based on a query. But I'm not sure how to send the entire result of the query as a message body. Any help is appreciated. Thanks,

    Doesn't it depend on what you want to send, do you want the results as just text in the e-mail or an attachment? Do you want csv, xls, xml? Once we know what you want to send we can probably give you some guidance on how you might best create the result you want. If you're already sending an e-mail you can easily add an attachment to the e-mail which would probably be your best bet as you don't know the size of the result set (?). I reckon this will be more of an issue around how you turn your results into a format that you can send rather than how you send it.
    Richard

  • All of the sudden my entire text message history was deleted, but if I search for a text it shows up in the results but will not open.  How can I restore the old text messages?

    I went to text message on my phone and when I looked down my entire text message history was gone.  When I sent a text message it showed up as the only box an there was not an Load Older Messages option.  But when I page over and search a word or name old messages show up in the results and when I press on them it opens the text message page but there is no text message.

    i think that was the problem. i simply downgraded to Firefox 5, not only because of the highlighted text fields, but because i was getting a lot of crash reports whenever i opened multiple tabs. downgrading to Firefox 5 resolved it.

  • Somehow the settings changed so the search results page has text so small that I can't read it

    when I launch firefox the initial page is find. I type in a search phrase, and the search results page comes up with print so small I can't read it. I can't find any way of changing the "view" of the results pages.

    See this:
    https://support.mozilla.com/en-US/kb/Page+Zoom

Maybe you are looking for

  • Soa_infra doesn't come up in SOA 11.1.1.5.0

    Hi, I have SOA 11.1.1.5.0 installation and everything was fine till now. I made some changes to the BPEL processes that are dependent on other bpel processes and redeployed them accessing the wsdls in oramds. To test the changes, I restarted the envi

  • WINDOW 8 STORE NOT WORKING!!! NEED TO UPDATE TO 8.1 PLZ HELP!!

    Hi, Every time i try to open the store it says it will not connect to the internet, even though i m conncted. I've tried a million things and it still wont wrk. I dont ussually use the store but i just want Windows 8.1 Plz help!!!

  • How many Effects do I need?

    OK. So maybe someone can help with THIS one... We have several lists of data categories (teachers, students and media) and each category has two states--pending and active, which we use Spry Tabs to move effectively between. We use a detail region to

  • Cannot connect to Linux BPELPM 10.1.2

    Hi All, After installing the production Linux release on RedHat 2.4.21-20.ELsmp I ran irca.sh to populated a localhost 10.1.0.3 DB. Changed the data-source entries to point ot this DB and fired up the BPELPM. JDEV fails on testing the connection to t

  • Hyperlinked images thin line in iExplorer

    When I tested my website it worked fine in Firefox and Chrome, but not in iExplorer. Hyperlinked images got a  thin purple line around them. Does anyone know how to remove that? It'd be very helpful! Thanks in advance!