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.
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 integrate full text search for django 1.10 with postgres database.
I am following tutorial from
https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/search/
class Question(models.Model):
text = models.TextField(max_length=500)
ans = models.TextField(max_length=1500, blank=True)
I have several questions in the database which has the text 'for' in its text field for example: one question is:
text: what is best for me?
ans: this is best for you.
I am trying to make a query like
q = Question.objects.filter(text__search='for')
But this query is not returning any result. can anyone suggest me why?
It is actually my mistake. For Full text search when Postgres creates index it by default ignore common words like 'the', 'for', 'are','is' etc. So If you try to search using this keywords you search query will return empty even if there are lots of sentences with these words.
I did not know this. So I thought I misconfigured.
I'm trying to do a document.writeln function based on a keyword search. If the user searches for the terms:
**widget xyz
xyz **widget**
my **widget** works
The searches are currently displayed this url format:
?Search=**widget**+xyz
?Search=xyz+**widget**
?Search=my+**widget**+
works
I would like to perform document.writeln on pages with the key word **widget** included in the search.
Here is where I'm at:
EXAMPLE 1:)
if (location.search == "**widget**")
document.writeln("\n<style type='text/css'>CUSTOM CSS</style>\n\n");
EXAMPLE 2:)
if (location.search == "**widget**"!= -1)
document.writeln("\n<style type='text/css'>CUSTOM CSS</style>\n\n");
The 2nd example kind of works, but shows the WriteIn on other keyword search results as well. Any help is much appreciated!
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
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.