Query like google

Hello,
I want to write query to search from two columns of a table like google i.e. this is example query:
*""I want to see rebar companies in china"*
The following table has country and products ('rebar')
My table:
SQL> desc company;
Name                                      Null?    Type
CO_ID                                     NOT NULL NUMBER(9)
R_DATE                                             TIMESTAMP(0)
CONAME                                             VARCHAR2(140)
ESTYR                                              NUMBER(5)
COUNTRY                                            VARCHAR2(32)
PRODUCTS                                           VARCHAR2(3900)
SQL> /
     CO_ID COUNTRY                          PRODUCTS
       173 china                            pipe fitting,valves,tee,reducers,elbows
       174 china                            angle bar
       175 china                            formwork,wing nut ,rebar,spring clamp ,wedge bolt,top cup,tie rod,scaffolding
       176 belgium                          ferro alloy producer
       177 china                            skyjumper,sky jumper,poweriser,powerskip,power shoes,flyjumper,jumping stilts
SQL> Thanks & best regards

Google uses a very sophisticated search algorithm, so I think you'll be a little pushed to replicate that or get anyone on the forum to do it for you.
You may be able to get something from using Oracle Text, if that suits your needs.
Alternatively, if you're looking to write your own thing then you would need some way of parsing the question and ignoring certain common words that you're not interested in, picking out just the words you want and then searching the relevant columns for those words.
Here's a very basic example:
SQL> ed
Wrote file afiedt.buf
  1  with company as (select 173 as co_id, 'china' as country, 'pipe fitting,valves,tee,reducers,elbows' as products from dual union all
  2                   select 174, 'china', 'angle bar' from dual union all
  3                   select 175, 'china', 'formwork,wing nut ,rebar,spring clamp ,wedge bolt,top cup,tie rod,scaffolding' from dual union all
  4                   select 176, 'belgium', 'ferro alloy producer' from dual union all
  5                   select 177, 'china', 'skyjumper,sky jumper,poweriser,powerskip,power shoes,flyjumper,jumping stilts' from dual)
  6      ,question as (select 'I want to see rebar companies in china' as q from dual)
  7      ,ignore_words as (select 'i' as wrd from dual union all
  8                        select 'want' from dual union all
  9                        select 'to' from dual union all
10                        select 'see' from dual union all
11                        select 'companies' from dual union all
12                        select 'in' from dual)
13  --
14      ,question_words as (select lower(regexp_substr(q, '[^ ]+', 1, rownum)) wrd
15                          from question
16                          connect by rownum <= length(regexp_replace(q, '[^ ]'))+1
17                          minus
18                          select wrd from ignore_words)
19  --
20  select *
21  from company
22  where co_id in (
23                  select co_id
24                  from company c, question_words q
25                  where c.country = q.wrd
26                  intersect
27                  select co_id
28                  from company c, question_words q
29                  where instr(c.products, q.wrd) > 0
30*                )
SQL> /
     CO_ID COUNTRY PRODUCTS
       175 china   formwork,wing nut ,rebar,spring clamp ,wedge bolt,top cup,tie rod,scaffolding
SQL>

Similar Messages

  • Internal knowlege base and highlighted abstract (like google)

    Two questions about searching ...
    1.) Is there a way to browse dump or explore the build-in knowledge bases?
    2.) We programmed stored procedures that returns a table with hits, containing among other things also a short abstract of the documents with highlighted search expressions (like google).
    We perform roughly the following sequence of queries:
    NumHits := CTXSYS.CTX_QUERY.count_hits(idx,QueryString,TRUE);
    OPEN SearchCursor FOR SELECT /*+ FIRST_ROWS */ score(1),title,url,summary,content_length,
    TO_CHAR(date_last_modified,'DD. Mon YYYY'), content_type, pk FROM directives
    WHERE CONTAINS (url, QueryString,1)>0 ORDER BY SCORE(1) DESC;
    ... and then for each hit line
    ctx_doc.highlight( index_name => indx, textkey => key, text_query => query,
    restab => res, -- out-parameter
    plaintext => false -- html
    Is there a more elegant and faster way to get documents and the positions of the query expression therein with one function call? Or is there a way to directly access the indices?
    With highlighting the abstract the queries take 10x longer!

    I had this issue myself, and implemented a work around that produces much faster results. I created a new CLOB column in my document database which contains the indexed BLOB and indexed it, so I have 2 indexes one on the blob, one on the clob. Upon insertion, deletion etc of a document I execute the ctx_doc.filter procedure on the blob and transfer the output to the CLOB column. To keep the indexes in sync, i conduct parallel syncs etc. While this approach may not seem ideal as it requires more space in the table, consumes more resources when altering the document table and requires extra steps to ensure proper data integrity it actually places less strain on the server when the application is run. Instead of executing the highlight, filter or markup procedure on the blob for every document returned in the query I simply execute it on the clob column which reduced the time to almost nothing. Why is this the case? When I created the index on the clob, I chose to use ctxsys.null_filter which bypasses the INSO filter and saves processing time. Now, instead of performing on the fly filtering(which is fine for one document at a time) I filter all documents when they are altered and simply execute the markup procedure on the filtered document. To trim the document, you can either pass the temporary clob to your application and trim it there or trim it in your procedure(the preferable option)

  • Both Firefox & IE crash even when I have disabeled plug-ins. I have installed new version of Firefox and problem continues. Seems to be related to Flash, but not sure. Firefox will stay open if I go to a page like Google. Also crashes in safe mode.

    Both browsers seem to crash when the web page wants plug ins to access pages. Simple ones like Google's home page, or these for example, work fine. I have run several scans with security software, including Malware (latest database), and they don't find anything.

    The problem began because my computer had to be sent in because it wouldnt turn on so i had to get it fixed they replaced the motherboard this was the second time the motherboard was replaced and once they did that my firefox hasnt worked the same. I can go on google chrome but thats not what i prefer to use.
    & when i right click on firefox it says troubleshoot so im assuming its built in to my computer. im not sure.
    I tried the profile manager to create a new profile and that has seemed to work so far. No crashing but it does freeze when i got to facebook and then i have to click ctr alt delete to open task manager to end firefox. It happened twice, the third time i went to google, then twitter and it didnt freeze. I then went to youtube and it froze. So Facebook and youtube make it freeze. Any idea why it does that?
    & thank you so much for helping and responding to me.

  • Can we have a query like

    Hi friends,
    I would like to know if this could be possible
    we have some 20 business like bus_ind, bus_usa, bus_jap...
    I have to do the below query each of the business
    for bus_ind
    SELECT COUNT(*)
    FROM bus_ind
    WHERE
    workdate BETWEEN TO_DATE('01/01/2008','DD/MM/YYYY') AND TO_DATE('31/12/2008','DD/MM/YYYY') AND
    workid NOT IN (6,7) AND
    NOT EXISTS (SELECT 'X' FROM bus_ind WHERE somecol = workid);
    instead of having 20 such query i was trying to see if there is a possibility to have a table like
    shytest
    id, tbl
    1 bus_ind
    2 bus_jap
    3 bus_usa
    and a single query like
    SELECT COUNT(*)
    FROM (select tbl from shytest where id=1)
    WHERE
    workdate BETWEEN TO_DATE('01/01/2008','DD/MM/YYYY') AND TO_DATE('31/12/2008','DD/MM/YYYY') AND
    workid NOT IN (6,7) AND
    NOT EXISTS (SELECT 'X' FROM bus_ind WHERE somecol = workid);
    Thanks
    -vish

    According to your requirnment there should be only one table for all the bussinesses with different partitions for all the bussiness.
    For now you can also create one veiw for all the business.. & fire you all query on that
    create or replace view business_view as
         select 'bus_ind' as business_loc, col1, col2, ... from bus_ind union all
         select 'bus_usa' as business_loc, col1, col2, ... from bus_usa union all
         ...Or you can also use Dynamic sql as all other are suggesting.
    Regards
    Singh

  • Opening a new link in a tab (contr+click or right click and open in new tab) causes ff to lose scroll position in first tab or main website, like google.

    Opening a new link in a tab (contr+click or right click and open in new tab) causes ff to lose scroll position in first tab or main window, like google.
    This does not happen when opening in a new window (shift+click).
    It was never a problem in older versions. I now have ff 3.6.17. I' afraid to install ff4 because everytime i do so (install e new version) something i liked dissapears or good add ons dont work anymore!
    I also don't like the fact that more and more of the adress barr is beïng used for crap i don't need. I'm a visual handicap and need all the space i can, just to read.
    Thanks for helping me out.

    To help other users find solutions, please return to this Thread and '''Sign-in''' to the forum with your Username and Password:
    click on '''"Solved It"''' next to the reply ABOVE that '''BEST''' solved your question
    '''DO NOT click "Solved It" next to this reply

  • I just bought an ibook pro and want to download a browser like google chrome which I am familiar with. Safari just seems to be a lot of icons for shopping and I would like to disable it and put something more functional in its place. How do I ?

    I thought I just posted this question but maybe not. I'm going from a PC to an iBook and am trying to customize it. Can I add a browser like google chrome or even foxfire and disable safari? Safari jst seems to be an app store. Thnaks

    It sound like you did something wrong. Try another download and install.
    Download of Chrome
    https://support.google.com/chrome/answer/95346?hl=en
    Direction to install
    Download the installer file
    Open the file called "Google Chrome.dmg" after it's downloaded.
    In the window that opens, drag the Chrome icon to the Application folder. This installs Chrome for all user accounts on your computer. Your home page settings and browser history will automatically be imported from your default browser.If you don't have administrative rights, drag the icon to a location on your computer where you do have rights, such as your Desktop. Chrome will only be installed for your user account.
    The first time you open the browser, the Finder will ask you to confirm that you want to open the application downloaded from the Internet. Click Open to continue.
    You'll see a message letting you know that you can search with Google directly from the address bar (also known as the omnibox). If you'd like to change yourdefault search engine, click Change.
    Unmount the Google Chrome disk image on your Desktop by dragging it to the Eject icon in the Dock. (Make sure you're dragging the disk image and not the Google Chrome application icon.)
    Allan

  • Can not open some pages on safari like google or facebook

    i can not open some pages on safari, like google or facebook have to turn off a try again then sometimes works

    Select  ▹ System Preferences ▹ Network ▹ Advanced ▹ TCP/IP ▹ Configure IPv6: Off. Apply the change and test. You must apply the change before it takes effect.

  • When i use a search engine like google, yahoo, etc., when I click on the link I am immediately redirected to a different site. How to I prevent this?

    when i use a search engine like google, yahoo, etc., when I click on the link, I am immediately redirected to another site. Many times I must hit "back", and click on the link again. Sometimes I am redirected again to another and different site. If I go back again and re-click, it will then take me to the link that is listed.

    Install, update, and run these programs in this order. They are listed in order of efficacy.<br />'''''(Not all programs detect the same Malware, so you may need to run them all to solve your problem.)''''' <br />These programs 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] <br />
    Windows Defender: Home Page - [http://www.microsoft.com/windows/products/winfamily/defender/default.mspx]<br />
    Also, if you have a search engine re-direct problem, see this:<br />
    http://deletemalware.blogspot.com/2010/02/remove-google-redirect-virus.html
    If these don't find it or can't clear it, post in one of these forums for specialized malware removal help: <br />
    [http://www.spywarewarrior.com/index.php] <br />
    [http://forum.aumha.org/] <br />
    [http://www.spywareinfoforum.com/] <br />
    [http://bleepingcomputer.com]

  • Power Query for Google Sheets

    Does anyone know of any plans to create an add-on for Power Query in Google Sheets?   I have played with the IMPORTHTML function but it doesn't provide the same data manipulation tools the PQ does.   I haven't had any luck finding anything in Google
    searches.
    Thanks

    Here's a way you can do this without a built-in connector:
    Make your Google Docs workbook visible to anyone that has the link (or public).
    Go File > Download as > Microsoft Excel.
    Get the link that was used in the browser's download manager.
    Go in PQ > From Web.
    Paste the link.
    Click "OK"
    The workbook will be download as an Excel workbook and opened in PQ.

  • CAn we write a query like this

    CAn we write a query like this?
    If not how can this be changed?
    select col1,col2,col3.col4
    from table 1
    where col1,col2 in(select col1,col2 from table2)

    Or it may be identical:
    SQL> CREATE TABLE t1 (c INT NOT NULL);
    Table created.
    SQL> CREATE TABLE t2 (c INT NOT NULL);
    Table created.
    SQL> INSERT ALL
      2  INTO t1 VALUES (rn)       
      3  INTO t2 VALUES (rn)
      4  SELECT rownum AS rn FROM user_tables WHERE rownum <= 15;
    30 rows created.
    SQL> BEGIN                                       
      2  DBMS_STATS.GATHER_TABLE_STATS(user,'T1');
      3  DBMS_STATS.GATHER_TABLE_STATS(user,'T2');
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM t1
      2  WHERE  EXISTS
      3         ( SELECT 1 FROM t2 WHERE c = t1.c )
      4 
    SQL> @xplan
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |    15 |    90 |     5 |
    |*  1 |  HASH JOIN SEMI      |             |    15 |    90 |     5 |
    |   2 |   TABLE ACCESS FULL  | T1          |    15 |    45 |     2 |
    |   3 |   TABLE ACCESS FULL  | T2          |    15 |    45 |     2 |
    Predicate Information (identified by operation id):
       1 - access("T2"."C"="T1"."C")
    SQL> SELECT * FROM t1
      2  WHERE  c IN
      3         ( SELECT c FROM t2 )
      4 
    SQL> @xplan
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |    15 |    90 |     5 |
    |*  1 |  HASH JOIN SEMI      |             |    15 |    90 |     5 |
    |   2 |   TABLE ACCESS FULL  | T1          |    15 |    45 |     2 |
    |   3 |   TABLE ACCESS FULL  | T2          |    15 |    45 |     2 |
    Predicate Information (identified by operation id):
       1 - access("T1"."C"="T2"."C")

  • Firefox crash when visiting Google products like Google calendar, Google Analytics.

    Hello
    Every time I open Firefox and then when I visit Google products like Google calendar or Google Analytics, Firefox crashes. Then I see Error Report window where I click "restart firefox" and then everything is ok.
    I submited crash report several times and I have this problem since version 25 and it persists now in version 34.0.5.
    I'm using Windows XP 32-bit.
    Best regards

    These are the recent crash IDs:
    bp-09f0ed27-a895-4f26-8a21-3e8ff2141209
    bp-c58086c4-f660-4b40-b030-50aa52141209

  • I do I 'drag' an application like Google Earth to my Hard Drive to install it?

    How do I 'drag' an application like Google Earth to my Hard Drive to install it?

    Click and hold on it, and then drag the cursor to the Applications folder, either in the Finder's sidebar, to an alias of it, or in a separate Finder window.
    (108558)

  • I am in Mexico, but do not want pages like google or yahoo to redirect to .mx sites. How do I make this stop happening?

    I am in Mexico, and pages like google or yahoo redirect to .mx sites. I would like to know how to keep them from redirecting, to stay at google.com / yahoo.com

    The problem is that what you are asking for is something you know you aren't going to get - specifically the
    I would also like Apple to provide a projected timeline for these fixes. Not a commitment, just a projected time-line.
    You know that is not how Apple do business - ever. While it's entirely possible they will ultimately meet your wishes in terms of the fixes, updates and added features, it won't be part of a 'deal' but just because they will continue to roll out their product plan as if nothing had ever happened.
    On the other hand, I have to say that I agree entirely. Much could and should be achieved simply by building on the platform and advancing it. It isn't an unreasonable wish to see that happen and to know it will happen. Just not Apple's way to tell anyone.

  • Hihaving a query like that who has done the Transport? How can i trace who

    having a query like that who has done the Transport? How can i trace who has done the transport (Import).
    I have tried with following steps but unable to find the right person.
    1. Go to TMS and disply the appropriate queue.
    2. Select menu path: Goto>Import History.
    3. Select menu path: Edit> Dipaly More.
    4. This will give the the "User" column.
    But my problem is the transport has happened long back. is there any other way to find out old import request who has done the transport.
    Please someone help me out on this.

    Do this may it can help you.
    At the last step where you had given "diaplay more"
    do this inspite of that:
    Extras --> Personal Settings
    Check the option "Query Interval Time" and try again.
    Best of luck !!!

  • Can't download apps like google, ebay, craiglist, bank of america

    is it possible to download from the app store apps like google, ebay, pandora,  for the iMac os x maverick ?

    To sum it up: No.
    Why?
    iOS apps can't run on the Mac OS X platform.
    Use Google Chrome as it has some plugins/webapps to do some of the things you're looking for.

Maybe you are looking for

  • GCWebservice not found (The requested resource does not exist)

    Dear expert, According to the following link, there is a standard web service allowing the update of xml file into portal : http://help.sap.com/saphelp_banking60/helpdata/de/45/485c1a5b875b3ee10000000a1553f6/frameset.htm The problem is that I get the

  • MacBook Pro doesn't see my iPhone to sync it

    I've been using my iPhone 3GS (OS 4) to run the Nike+ app, and have been syncing it nearly daily to my MacBook Pro (OS 10.4.11) after my runs. A few days ago when I tried to sync, the computer didn't recognize the iPhone was connected. I purchased a

  • Outbreak filters (OF/VOF) released viral emails

    Hello, yestearday 24.2.2015 around 9:00 CET we were on the top of viral email attack. In less than one hour OF on the Ironport started to react on this attack. That's great. But at midnight all emails from OF quarantine from this attack was released

  • AT&T recent data plans for smartphone

    Not sure if there is any gotcha but recently ATT announces the new data plan for smartphone users.  With $160 per month you have - Unlimited voice/text - 4 smartphone lines - 10 GB data share With the same amount of monthly I have with Verizon - 700

  • Assigning applications to spaces

    Hello, I need an Automator application that can assign certain applications to a specific Space. Here is what I have so far: Ask for Finder Items Set Value of Variable Get Value of Variable And an Applescript as the following: on run {input, paramete