What am I doing wrong with my full text search? If this code
Select UserID, UserName
From Users
Where Contains([UserName], '%Jack%')
I get the user jack back, but if I do this
Select UserID, UserName
From Users
Where Contains([UserName], '%Ja%')
I get nothing what am I doing wrong?
You're mixing LIKE syntax with CONTAINS. Keep in mind that full text searching is word based, while like searches for a character pattern within a string.
Try:
Select UserID, UserName
From Users
Where Contains([UserName], '"Ja*"')
Contains([UserName], '"Ja*"') - Syntax for PREFIX search. Would match "Jack" but NOT "Ajax"
You cannot do any POSTFIX search with full text search. If you were to try:
Contains([UserName], '"*Ja*"') -- wrapped in *
This would actually still do a PREFIX ONLY search, it will strip out all special characters that are not proper syntax, meaning the first * would be stripped then ran. If you need open ended search you need to use %% still to find inner parts or words.
Related
I am trying to search for a pattern(see below) in the logs using splunk. The String which I am going to search includes double quotes.
Below info log is printed in the logger..
INFO: o.l.k.SomeClass: {"function": "delete", "tenenId":"15897",.......}
And the string i want to search is
"function": "delete"
The splunk query I am trying to execute is.,
index="12585" "\"function\": \"delete\""
I am not quite sure if this is going to work. Any suggestions?
There are probably multiple whitespace characters between functionand delete. I suggest you just search for the two phrases separately, rather than together
index="12585" \"function\": \"delete\"
Since your data is in raw format, you can look if the "function" field is automatically extracted by Splunk. If yes, you can simply search for index="index_1" function="delete" else, you can search for index="index_1" "function" "delete" as is, and Splunk will search for function and delete in your raw event.
I was researching for a similar problem where I need to search for exact string match which includes double quotes. It doesn't look like we can directly query with escaped double quote. So we have to use regex.
In your scenario, you could try this query:
index="12585" | regex fieldname=".*\"function\": \"delete\".*"
It will try to run regex match on the fieldname. The regex can be validated in any online regex tester.
I haven't figured out how to query with _raw field. Doing _raw=".*\\\"delete\\\".*" doesn't seem to be returning anything..
I am trying to query a table with a phrase and get results that fully match my phrase. For example if I search for
WHERE CONTAINS(prc.SectionContent, '"check this"')
I get results that contain the specific words too.
I would like it it behave like a wildcard search such as:
WHERE SectionContent LIKE '%check this%'
which returns results that have the full phrase only.
Try using;
WHERE SectionContent LIKE 'check this'
If you remove the % (wildcards) it will search just the text.
Looking for some help here if anyone can offer some. I am working with an oracle database and I would like to trim a string up until a certain character '/'. These fields are paths of a URL and they are all different sizes so I need to make sure it's getting to the very last '/' in the URL and removing everything up until that point. Additionally, there is a session ID that is associated with some of these URLs that is located at the end of the string and has a semi-colon before it starts, so I would want to remove everything that contains a semi-colon up to the semi_colon and on. So essentially I want to remove content from the beginning of the URL and from the end of the URL if applicable. Examples of these URL's (string) are as follows:
Current URLS
/ingaccess/jsp/mslogon.jsp
/ingaccess/help/helpie_term_cash_surrender_value.html
/eportal/logout.do;jsessionid=xr8co1kyebrve47xsjwmzw--.p704
/eportal/logout.do;jsessionid=gdh_e_e1m1hna0z9ednklg--.p705
/ingaccess/help/helpie_term_northern_unit_value.html
/ingaccess/help/helpie_scheduled_rebalance.html
/eportal/home.action;jsessionid=9vhfbkhunkvtcm5g1dtgsa--.p704
/ingaccess/help/helpie_catch_up_50.html
/ingaccess/piechartmaker
/ingaccess/help/helpie_term_fund_balance.html
Desired URLS
mslogon.jsp
helpie_term_cash_surrender_value.html
logout.do
logout.do
helpie_term_northern_unit_value.html
helpie_scheduled_rebalance.html
home.action
helpie_catch_up_50.html
piechartmaker
helpie_term_fund_balance.html
Anyone know of an easy fix here? I've tried working with SUBSTR and REPLACE a bit but can't seem to get them to work.
Thanks a bunch in advance,
Ryan
Try this
SELECT CASE WHEN INSTR (surname,';')>0 THEN SUBSTR(surname,1
,INSTR(surname,';',1,1)-1) ELSE surname END FROM
(SELECT SUBSTR(column,INSTR(column,'/',-1)+1) AS surname
FROM tableName)
Tested on Apex
I want get lei4#gmail.com by searching lei4 or gmail.com.
The first one only have token: email.
What I want is like the second one
Can we parse the email to email, asciiword and host token? any ideas will help.
I already read the tsearch2 guide, reference, etc. can't find the solution.
A simple solution would be to transform email addresses into local-part at domain-part before feeding them to the TS parser.
Since at is a stop word in english, it will be ignored.
=> select to_tsvector('english','lei4 at gmail.com');
to_tsvector
------------------------
'gmail.com':3 'lei4':1
So both lei4 and gmail.com are going to be found in this tsvector.
As a side note, lei+4#gmail.com is a valid email address and the TS parser is wrong in tokenizing it into four parts.
I need to search with FTSearch something like this - MS004790(419411/10). But it thorws NotesException: Notes error: Query is not understandable (MS004790(419411/10))
So maybe there is some trick to search strings like that or maybe I need to parse it somehow?
Tnx for help!
TL;DR: Wrap your search in quotes.
Full Text search has two modes. Web Search and Notes Search. In your notes preferences you can set this.
Web search is just like a text search. Notes search attempts to parse the search term.
However the client can fall back to Notes search terms if it sees the first characters are capitals (or capital reserved keywords like "FIELD"). So to prevent it from parsing you need to wrap it in quotes.
For example
(LotusScript)
searchString = |"MS004790(419411/10)"|
(Java)
searchString = "\"MS004790(419411/10)\""
If it is still failing after that, manually try the search in the FT search bar. Once you have that working the code should work the same way.
If it is still failing at that point it may be related to the UNK table. If so see the following:
Lotus Domino: After changing TYPE of a field, Full Text Search won't work for this field