Postgresql wildcards to search functions - search

Is there a way in Postgresql to call \ef or \df on a function or table name with wildcards.
An example of the way I think it would work is \ef fn_%some%get%function%
This way I could find functions even if I only know part of the table or function name.
Thanks for the help!

Yes you can use wildcards, this is explained in detail in the manual:
http://www.postgresql.org/docs/current/static/app-psql.html#APP-PSQL-PATTERNS

Related

How do I find mispelled words with sphinx?

Let's say I have the word "catheter". A user tries to search on my web app for that word but spells it "cathiter" or "cattiter" instead. How can I use SphinxQL to match the word from my SQL database based on the incorrectly spelled word? What would my query look like? Do I need to enable something in my index on my conf file? From my understanding, enable_star has been deprecated.
Yes, enable_star=0 has been depreciated, but not sure how that relevant!
Anyway sounds like you want the CALL SUGGEST function
http://sphinxsearch.com/blog/2016/10/03/2-3-2-feature-built-in-suggests/
The defuult settings a good place to start...
CALL QSUGGEST('cathiter','yourindex');
... if you dont min_infix_len defined on index, will need that. Alao dict=keywords - for some reason that requirement not mentioned in blog post.

No result if search contains dot and wildcard

I use azure search and have some document with a field like this {"Nr": "123.334.93"}.
If i search for querytype=full&search=123.334.93 then it found multiple document and if I search for querytype=full&search="123.334.93" then it found one document. This is as expected.
But if I search for querytype=full&search=123.334.9* I expect multiple document starting with 123.334.9 but none result are given back.
Do I miss somthing?
The same is when I use a regex expression like this querytype=full&search=/123\.334\.9.*/
Your query looks correct to me and should work.
A couple of things you might look into.
1) Sometimes you need to escape the * like this:
querytype=full&search=123.334.9\*
Usually, this is only necessary if you have more search terms after the *.
2) You can also narrow the fields searched down to only the field you need (for better efficiency) like this:
querytype=full&search=Nr:123.334.9\*
Hope this helps.
Based on the Comment from Yahnoosh.
The analyzer of the field was set to "de.microsoft". I change that to "standard.lucene", recreate and fill the index and it works as expected.
It seems that I have to be more carefully to set the analyzer and only use specific ones for fields with language specific content.
Thanks for your help.

Wildcard searches using dismax handler?

I have successfully indexed files, and want to be able to search using wildcards. I am currently using the dismaxRequestHandler (QueryType = dismax) for the searches so that I can search all the fields for the query.
A general search like 'computer' returns results but 'com*er' doesn't return any results.
Similary, a search like 'co?mput?r' returns no results.
Could someone please tell me a way to continue using dismax and be able to do wildcard searches in the 'q' field?
Does edismax handler have this? If so, How do I use it. I have Solr 1.4.1.
Please help me out.
Thanks.
Imran.
Grab latest (trunk) build from Hudson. Use <str name="defType">edismax</str> in the RequestHandler to activate edismax.

Drupal Views Arguments

I know how to successfully use arguments in drupal's views module, but when it "filters" based on those arguments it uses "=" in the where clause of the SQL statement. However, I would like to use "like" instead of "=" in the where clause of the SQL statement so I can pass in, say the title of a node, as an argument and then show all nodes that CONTAIN the title passed in. I am not interested in grabbing only the nodes where the title is exactly the same as the title passed in. Does anyone know how I can do this? Is this possible?
one possible solution would be to generate the view by code with your required query.
I am looking for the same solution. It looks like you can modify the query using the views_views_pre_execute hook. The link below has a pretty good explanation. Haven't tried it yet but giving it a shot now...
http://drupal.org/node/409808
You could export the view, which outputs the views-generated query as code, then modify the query to suit your needs, and load it programatically (http://www.chilipepperdesign.com/2010/01/15/how-to-programmatically-create-views-in-drupal-6)
In drupal 7 you can use views query alter to generate your custom querys:
Take a look at this example: https://gist.github.com/4001074
I don't think you can do this. See here (https://www.drupal.org/node/1578564):
There are no options for selecting which operator should be used with contextual filters (save the exclude option). All default to is equal to.

Naming decision: "Create it if it doesn't exist" in one word

Exact duplicate of
Function name for creating something if it's not there yet
I have a function which checks if a certain thing exists, and if not, creates it. What would be a good word for it? Right now I'm using "maintain", so the function is called maintain_buffer_on_path, but I think that "maintain" is misleading. Can you think of a better one-word name?
I usually use ensure for this.
EnsureExists (or simpler Ensure) seems to be some kind of a convention.
I've heard the word vivify to refer to this.
I've used summon for this before.

Resources