Search for exact match without additional words

Hi everybody,
is it possible to find out if a tag contains a certain word or phrase and nothing else? E.g. the search for all documents with the title "foo" should match all documents containing <title>foo</title> but not documents that contain something like <title>foo bar</title>. I tried something like "( foo ~ ( % ~ foo ) ) WITHIN title" but I get a "wildcard query expansion resulted in too many terms" error, so using a wildcard is no option here. Any ideas?

Another method would be to use extractvalue to limit the rows. It would still use the text index to get the rows with foo in it, then extractvalue would limit it to just those rows where only the word foo is in it. This would eliminate the need for a procedure or user_datastore or increasing the index size. Please see the demonstration below.
SCOTT@orcl_11gR2> create table documents
  2    (text  varchar2 (45))
  3  /
Table created.
SCOTT@orcl_11gR2> insert all
  2  into documents values ('<title>foo</title>')
  3  into documents values ('<title>foo bar</title>')
  4  into documents values ('<title>bar foo</title>')
  5  select * from dual
  6  /
3 rows created.
SCOTT@orcl_11gR2> insert into documents
  2  select '<title>' || object_name || '</title>'
  3  from   all_objects
  4  /
76012 rows created.
SCOTT@orcl_11gR2> create index test_idx
  2  on documents (text)
  3  indextype is ctxsys.context
  4  parameters
  5    ('section group ctxsys.auto_section_group')
  6  /
Index created.
SCOTT@orcl_11gR2> set autotrace on explain
SCOTT@orcl_11gR2> select * from documents d
  2  where  contains (text, 'foo within title') > 0
  3  and    extractvalue (xmltype (d.text), '//title') = 'foo'
  4  /
TEXT
<title>foo</title>
1 row selected.
Execution Plan
Plan hash value: 3102160860
| Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT            |           |     1 |    36 |    10   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS BY INDEX ROWID| DOCUMENTS |     1 |    36 |    10   (0)| 00:00:01 |
|*  2 |   DOMAIN INDEX              | TEST_IDX  |       |       |     4   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   1 - filter(EXTRACTVALUE("XMLTYPE"."XMLTYPE"("D"."TEXT"),'//title')='foo')
   2 - access("CTXSYS"."CONTAINS"("TEXT",'foo within title')>0)
Note
   - dynamic sampling used for this statement (level=2)
SCOTT@orcl_11gR2>

Similar Messages

  • ITunes 10 search for exact match or Boolean Searches

    Is there a way to force an exact match when performing a search in iTunes?
    I tried putting "" around my search and get no results.
    The goal would be to search Artists for the artist "Hem", and only show results for only "Hem" and not both "Hem" and "Edie Brickel and the New Bohemians"
    As far as I can tell there are no Boolean search options in here either.
    iTunes 10.1 (54)

    Mad.Macs wrote:
    Thanks,
    I know Smart Playlists is a workaround for this, but that is about that is about 6 clicks plus typing to accomplish what could be done by simply typing in "hem" in the search field. If you use Smart Playlists for this, you would also need to go back and delete the playlist when you are done.
    Yep, like I said I leave it there for next time....
    I wonder why they would leave what is now a universally understood search option out of iTunes?
    Who knows? Feature requests go to iTunes Feedback.
    tt2

  • Search for exact phrase

    (Adobe Reader XI, version 11.0.06, Windows 7 Professional SP1, 32-bit)
    I'm reviewing a PDF document that has various occurrences of mixed case "plug-in", "plug in", and "plugin", sometimes the 'p' and/or 'i' is capital.  I cannot find a way to make Reader XI search for and match ONLY the following 7 characters:
    plug in
    That's p-l-u-g-space-i-n.  When performing a case-insensitive search for <plug in> (I'm using < and > as delimiters just for the rest of this message posting, can't use quotes as you'll see shortly) it matches <plug in>, of course, but it also matches <plug-in>.  I don't want all those <plug-in> matches because a hyphen is not a space.  (There are LOTS of matches on <plug-in> and they bury the few matches of <plug in>.  So I gotta search this big list to find the few correct matches...and then wonder if I missed any.)
    In the advanced search option it says to use quotes to make Reader search for an exact phrase or words.  Well, when using quotes in the search box they are not delimiters of an exact phrase, they are part of the search.  For example, as a sanity check I did a search on the eight characters quotation-p-l-u-g-i-n-quotation <"plugin">.  That should match all occurrences of <plugin> because I enclosed it in quotation marks, right?  The search for <"plugin"> produces one match - the single instance of <"Plugin"> in the entire document...so the quotes are part of the search, they don't delimit an exact phrase.
    I'm sure the error is on my part, I just don't know what I'm missing here.  Please help if you can.
    thanks,
    Steve T.

    Thanks for the quick response, Gilad D.  I tried those options before posting this question, and again about 5 minutes ago just to be sure.  I tried them both together and both separately, but no joy - searching for <plug in> still matched both <plug in> and <plug-in>.

  • On iMac maverick using numbers how do I search for an address without scrolling through all. Chris

    On iMac with maverick using numbers spreadsheet, how do I search for an address without scrolling through the lot.

    Better to post your topic in the dedicated Numbers community >  Numbers for Mac: iWork: Apple Support Communities

  • Search MS Word for Exact Match

    I've got a script that opens an MS Word document, then searches through a directory for each image file (.jpg), then does a find and replace using the filename as the search string, and inserts the image in place of the text it finds. My problem is that
    it's not doing an exact match. This means for example that if it looks for image1.jpg and that text exists in the word document inserts the image in it's place (the text being a placeholder). But if mimimage1.jpg was in place before it then it would insert
    the .jpg there - not doing an exact match.
    Here's the code I've got so far:
    # Get variables from XML file
    $MyDir = Split-Path $MyInvocation.MyCommand.Definition
    # Get settings from variables.xml.
    [xml]$settings = get-content "$MyDir\variables-test.xml"
    # Assign the settings to local variables.
    $SMTP = $settings.Settings.Setting.SMTP
    $port = $settings.Settings.Setting.port
    $from = $settings.Settings.Setting.EmailFrom
    $to = $settings.Settings.Setting.EmailTo
    $subject = $settings.Settings.Setting.Subject
    $body = $settings.Settings.Setting.Body
    $savepath = $settings.Settings.Setting.SavePath
    $docfile = $settings.Settings.Setting.WordDoc
    $XMLpath = "$MyDir\variables.xml"
    [String[]]$strXML=@()
    [xml]$xml = get-content $XMLpath
    $parse_results = New-Object System.Collections.ArrayList
    add-type -AssemblyName "Microsoft.Office.Interop.Word"
    $wdunits = "Microsoft.Office.Interop.Word.wdunits" -as [type]
    $application = New-Object -comobject word.application
    $application.visible = $false
    $document = $application.documents.open($docfile)
    set-variable -name wdGoToLine -value 3 -option constant
    set-variable -name wdGoToAbsolute -value 1 -option constant
    # Create new directory
    $date = (Get-Date -format "dd-MM-yyyy")
    $newdir = $savepath + "archive" + "-" + $date
    New-Item -ItemType directory -Path $newdir
    # Search Word document for filename and insert image
    foreach($file in Get-ChildItem $savepath -Filter *.jpg)
    if ($application.Selection.Find.Text = $file)
    if ($application.Selection.Find.Execute())
    $insertfile = $savepath + $file
    $objSelection = $application.selection
    $objShape = $objSelection.InlineShapes.AddPicture($insertfile)
    $gotoline = $objSelection.GoTo($wdGoToLine, $wdGoToAbsolute,1)
    # Move spreadsheets and images to archive location and cleanup after dfm2xls.ps1 before ending script
    foreach($movexlsx in Get-ChildItem $savepath -Filter *.xlsx)
    $xlpath = $savepath + $movexlsx
    Move-Item $xlpath $newdir
    foreach($movejpg in Get-ChildItem $savepath -Filter *.jpg)
    $imgpath = $savepath + $movejpg
    Move-Item $imgpath $newdir
    # Save document then close application
    $newsave = $savepath + $date + "-report.docx"
    $document.SaveAs([ref]$newsave)
    $document.Close()
    $application.quit()
    At the moment it doesn't do an exact match but I've tried using:
    $MatchWholeWord = $True
    $MatchCase = $False
    and then
    $application.Selection.Find.Execute($MatchWholeWord, $MatchCase)
    But that stopped it from finding any matches. Can anyone help?
    Thanks in advance

    Hi AJ Mellor,
    If you want to replace the words of the .jpg file's name with the picture in word file, this script should be helpful for you to modify your script:
    Hey, Scripting Guy! How Can I Read Words in a Text File and Make Those Same Word Italic in a Word Document?
    Insert pictures in a folder into a Word document (PowerShell)
    In addition, to get the words of the file name instead of the full path name, please refer to the script below:
    $files = Get-ChildItem $savepath -Filter *.jpg
    $words = $files.basename
    foreach($word in $words){
    I hope this helps.

  • Searching for exact text

    Hi - I've a problem when looking for exact text, eg:
    SetStatusBarMessage AND "C#"
    This matches any words beginning with C - how can I specifically look for the phrase C# ??
    (see the results: http://img12.imageshack.us/img12/5259/screenw.gif )
    Pat Read

    No. There is nobody here who works for Apple, the forum us strictly user-to-user.
    I wouldn't say it's "strictly user-to-user". As terms & conditions states:
    Apple involvement. Apple does not formally provide technical support on the Site. However, any information that is provided by Apple or Apple employees is offered on an "AS IS" basis without warranties of any kind.
    Thanks for the suggestion. Although, the problem is not really to get rid of the message (as you can dismiss it quite easily) but to understand why it appears there in the first place. Is it a malware? is it a bug?
    So thanks for that. Although as you mentioned, it wasn't very enlightening.
    (The 2000 views were probably a couple of years ago. Look at the dates on the posts.)
    I did. Half the people who posted had this issue in 2011, and the other half (including me) posted in the last couple of months. So it might be a recurring thing.
    I have no idea when 2000 users googled "Tap Continue and sign in to purchase a gift" and viewed this post. Could have been 2 years ago or in the last couple of months.

  • Open item Settlement for exact match.

    Hi All,
    We have requirement in our project to clear the exact match first ahead of the oldest due debt.
    To elaborate on the requirement, please have a look at the following example.
    1st Invoice -$100  Due date-1/11/2010
    2nd Invoice-$250  Due date-1/12/2010
    Customer makes a payment of $250 on 10/12/2010.
    As per our requirement, It should clear the 2nd Invoice first, as it gets an exact match and not the oldest debt due.
    However, if the customer makes a payment of say $300, then it does not find any exact match and hence will clear the oldest due first.In this case,the 1st invoice.
    In the clearing Step under the clearing variant , we have tried to use the Amount rule as '0'-Clearing only possible when amounts are same.....but it is not working as per our requirement.
    Can any one of you give any thoughts on the issue?
    Thanks,
    Amlan

    Hi - tried this config, and I cleared an open item based on exact amount, that was due later that 2 other items. See below.
    Ivor Martin
    Clearing Var.   ZEX  Exact matching test
    Clearing Step   1    Exact match on amount
       Char.                    Grpng rule    Sort charact.           Rank     Sort
    1. 013  Open Amount Without In          1.
    2.                                      2.
    3.                                      3.
    4.                                      4.
    5.                                      5.
      Amount Rule     0
      Clearing rule                                  Paymt rem. var.  ZEX / 2
                                                     End of assgmt
                                           / 0
    Clearing Step   2    Oldest due date
       Char.                    Grpng rule    Sort charact.           Rank     Sor
    1. 015  Contract Account                1. 010  Due date
    2.                                      2.
    3.                                      3.
    4.                                      4.
    5.                                      5.
      Amount Rule
      Clearing rule                                  Paymt rem. var.      / 0
                                                     End of assgmt    9
                                           / 0

  • How to search for exact string?

    Is there any way to search for the text string exactly as I enter it? Like 'exact search' in the OSS notes?
    For example, I'm trying to find the forum posts regarding the Excel 2007 file format XLSX. By XLSX the search finds hundreds of entries, but most of them are not even close. For example, this was one of the top results: /thread/1078918 [original link is broken]
    Why is it getting picked up when 'xlsx' doesn't even appear there? We are frequently complaining about the users who don't use search before posting, but, frankly, if it works like this, I can't blame them...

    >
    Jelena Perfiljeva wrote:
    > Why is it getting picked up
    >
    => https://forums.sdn.sap.com/search.jspa?threadID=&q=%22Whyisitgettingpicked+up%22&objID=f40&dateRange=all&numResults=15&rankBy=10001
    "Why is it getting picked up"
    I regularly use this to (re)find threads where I remembered a specific comment or even spelling mistake.
    Perhaps a better option in your case would be to use an AND between individual terms.
    I generally tend to edit the search string parameters directly, as it seems to cache previous results and do a search within a search. That might be an option for you as well though.
    Cheers,
    Julius
    Edited by: Julius Bussche on Jul 10, 2009 11:38 PM

  • FQL query text to search for exact string

    Hi
    we are using SharePoint 2010 with FAST search...
    I'd like to be able to search for this exact string that contains parentheses...  "(ABC)"
    I thought it would be:
    ManagedProperyName:"(ABC)"
    this returns results with just ABC ... it ignores the parentheses... i need to only show documents with "(ABC)"

    For exact query you can use  equals. For example MPName:equals("<term or phrase>")
    However, in your case the parenthesis is considered a special characters which are stripped off during document processing and at query time.

  • My iphone 4 with latest software update has a problem with bluetooth.  It continually searches for other devices without showing any other bluetooth devices

    I have an iphone 4 with latest software update.  When entering the settings for bluetooth it continues to search for devices.  It does not highlight any device, just continuous searching

    Hello:
    What are you trying to do?  If you do not wish to connect to other BT devices, turn BT off.
    Barry

  • IOS 7.0.3: iPhone 5 keeps searching for a network without sim

    Hi there
    I update my iPhone 5 from 7.0.2 to 7.0.3 yesterday.
    Since then my iPhone does not care about the sim card.
    I can remove the sim card and the iPhone keeps searching for a network.
    Whe I insert another sim, the iPhone does not ask for a pin.
    I did a iPhone Restore. Saddly the bug is still there.
    My problem no is, I cannot activate my iPhone after the restore, because of the sim card problem.
    Is there a simple solution, or shoud I go to an Apple Store?
    Thanks!

    My solution was the Recovery Mode:
    http://www.guidingtech.com/16064/put-iphone-in-recovery-mode/

  • Search Array of String for exact match words

    I need to create a search feature.
    There will be a textfield where the user will input a word or words.
    Then I need to check if the are any reference in the array of names.
    namesArray ["ocean in the sky", "cean on sky", "cean is white"];
    keywordsArray ["cean", "sky"];
    matchCounter = 0;
    If I input the word "cean" I dont want in my results "ocean in the sky", only "cean is sky".
    I have the following code:
    for (var j:int = 0; j < namesArray.length; ++j)
         var tempStr:String = namesArray[j];
         for (var k:int = 0; k < keywordsArray.length; ++k)
              if (tempStr.indexOf(arrayKeywords[k]) != -1)
                  matchCounter++;
         if(lengthKeywords == matchCounter)
              trace("yeahhh... there's a match!!");
         matchCounter = 0;
    Is there a better way? How can I do this?

    There are few things but the main problem is that "new RegExp()" needs double escapes ("\\")
                var namesArray:Array = ["ocean in the sky", "cean on sky", "cean is white"];
                var keywordsArray:Array = ["cean", "sky"];
                for (var j:int = 0; j < namesArray.length; j++){
                    var matchCounter:uint = 0;
                    var tempStr:String = namesArray[j];
                    for (var k:int = 0; k < keywordsArray.length; k++){     
                        var regExp:RegExp = new RegExp("(\\s+|^)" + keywordsArray[k] + "(\\s+|$)"); 
                        if (tempStr.search(regExp) > -1){
                            matchCounter++;
                    if(keywordsArray.length == matchCounter){
                        trace("\"" + namesArray[j] + "\" matched all the keywords");
    Traces:
    "cean on sky" matched all the keywords

  • How can I search for partial matching words in various columns without needing to provide search text?

    I have a list of names in three columns - B2:B425, D2:406, & E2:30 where they were input by different people, so the names are worded differently. For example, I can have the name "Handler, Jones, & Wright" and someone else has the name
    listed as "Handler Corp." What I need is to find a formula or VBA macro code that can search through my list and notice the possible duplicates and highlight them. Since they are all different names, I cannot give it a unique "text" to
    search.
    I found a code posted in this forum from some time ago (for two columns) but it highlighted all these names that had no partial words in common. Perhaps you can look over the code below and modify it for me or provide me with another one? Please let me know
    if you need any further information to guide me. 
    Sub HighlightDups()
        Dim rg1 As Range, rg2 As Range, c As Range, d As Range
        Dim sTemp As String, sTempWords() As String, sTempDWords() As String
        Dim re As Object, mc As Object
        Dim i As Long, j As Long
        Dim sFirstAddress As String
    Set rg1 = Range("B2", Cells(Rows.Columns.Count, "B").End(xlUp))
    Set rg2 = Range("D2", Cells(Rows.Columns.Count, "D").End(xlUp))
    Set re = CreateObject("vbscript.regexp")
        re.Global = True
        re.ignorecase = True
    With Range(rg1, rg2)
        .Font.Color = vbBlack
        .Font.Bold = False
        .Interior.Color = xlNone
        .FormatConditions.Delete
    End With
    For Each c In rg1
      re.Pattern = "\b\w+\b"
      If re.test(c.Text) = True Then
        Set mc = re.Execute(c.Text)
            ReDim sTempWords(0 To mc.Count - 1)
            For i = 0 To UBound(sTempWords)
                sTempWords(i) = mc(i)
            Next i
        For i = 0 To UBound(sTempWords)
            Set d = rg2.Find(What:=sTempWords(i), _
                             LookIn:=xlValues, _
                             LookAt:=xlPart, _
                             MatchCase:=False)
            If Not d Is Nothing Then
                re.Pattern = "\b" & sTempWords(i) & "\b"
                sFirstAddress = d.Address
                Do
                        If re.test(d.Text) Then
                    With c
                        .Font.Color = vbWhite
                        .Font.Bold = True
                        .Interior.Color = vbBlue
                    End With
                    With d
                        .Font.Color = vbWhite
                        .Font.Bold = True
                        .Interior.Color = vbBlue
                    End With
                        End If
                    Set d = rg2.FindNext(after:=d)
                    Loop While Not d Is Nothing And d.Address <> sFirstAddress
            End If
        Next i
      End If
    Next c
    Set re = Nothing
    End Sub
     

    Programming/Code related questions should really be posed in one of the following forums
    Excel for Developers
    http://social.msdn.microsoft.com/Forums/en-US/exceldev
    Microsoft Office Programming
    http://answers.microsoft.com/en-us/office/forum/customize?page=1&tab=all&tm=1361680524815
    Tony Chen
    TechNet Community Support

  • Ebay set in seach bar so I cannot search for other websites without knowing their exact www adddress

    as above

    Starting in Firefox 23, the address bar uses the same search engine as the search bar. You can undo that change using an add-on, or if you don't need them to be different, select your preferred search engine in the search bar.
    If relevant, here's the add-on: https://addons.mozilla.org/firefox/addon/keyword-search/

  • How to search for specific match from an array?

    Hi Mike,
    Thanks for the reply.
    I am reading a position of switches whether ON/OFF. It is nothing but the digital inputs status from the field. I am Indexing that array, and connect it to the LED indicators to show the relevant status. Also I want to raise an alarm  once, for the ON switches.  By using Search 1D array, I got the first TRUE match index from the array. But if I want to know all the occurrences of ON condition (TRUE from an array of booleans) from an array of switches. How to do that?
    Hope this clarifies.
    Thanks
    Kousy

    I almost missed this message because you started a new thread.
    In any case, the code altenbach posted will give you an array of the indexes that are set to true. So it sounds like that is at least part of what you want. The alarm you mention, is that one "master" alarm if any of them are true, or is it a separate alarm for each bit?
    If it is one "master" alarm for all of them the logic menu has a function for ORing all the elements in a boolean array. Also when you say "alarm" what is the nature of this alarm? A dialog box? a flashing light (real or on the applications's front panel)? message in a status display?
    The attached code shows one possible direction by adding onto altenbachs code the ability to accumulate a single error message based on the states of individual bits. (BTW: The other alternative that you might see would be to pass the array into a loop and use a case to append a message of the bit is true. The advantage of the one in the combined VI is that the loop only iterates for the number of true bits +1. Where as the other approach would have to look at all the bits one at a time.)
    In a sense this is why I asked for clarification because there are a lot of things you can do when parsing an array like this.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
    Attachments:
    TRUEadditions.vi ‏31 KB

Maybe you are looking for