Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4066758
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:10:00+00:00 2026-05-20T16:10:00+00:00

If I have strings/phrases like this stored in the database: What are Q-type Operations?

  • 0

If I have strings/phrases like this stored in the database:

  • What are Q-type Operations?
  • Programmer’s Guide
  • A.B.C’s of Coding

Is there a way to pass a query parameter in like "Programmers" or "abc" or "q-type" and have it find "Programmer's", "A.B.C" and "Q-type"?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:10:01+00:00Added an answer on May 20, 2026 at 4:10 pm

    tsvector

    Use the tsvector type, which is part of the PostgreSQL text-search feature.

    postgres> select 'What are Q-type Operations?'::tsvector;
                  tsvector               
    -------------------------------------
     'Operations?' 'Q-type' 'What' 'are'
    (1 row)
    

    You can use familiar operators on tsvectors as well:

    postgres> select 'What are Q-type Operations?'::tsvector
    postgres>        || 'A.B.C''s of Coding'::tsvector;
                               ?column?                           
    --------------------------------------------------------------
     'A.B.C''s' 'Coding' 'Operations?' 'Q-type' 'What' 'are' 'of'
    

    From tsvector documentation:

    A tsvector value is a sorted list of distinct lexemes, which are words that have been normalized to merge different variants of the same word (see Chapter 12 for details). Sorting and duplicate-elimination are done automatically during input

    If you also want to do language-specific normalization, like removing common words (‘the’, ‘a’, etc) and multiplies, use the to_tsvector function. It also assigns weights to different words for text search:

    postgres> select to_tsvector('english',
    postgres> 'What are Q-type Operations? A.B.C''s of Coding');
                          to_tsvector                       
    --------------------------------------------------------
     'a.b.c':7 'code':10 'oper':6 'q':4 'q-type':3 'type':5
    (1 row)
    

    Full-blown text search

    Obviously doing this for every row in a query will be expensive — so you should store the tsvector in a separate column and use ts_query() to search for it. This also allows you to create a GiST index on the tsvector.

    postgres> insert into text (phrase, tsvec)
    postgres>   values('What are Q-type Operations?',
    postgres>   to_tsvector('english', 'What are Q-type Operations?'));
    INSERT 0 1
    

    Searching is done using tsquery and the @@ operator:

    postgres> select phrase from text where tsvec @@ to_tsquery('q-type');
               phrase            
    -----------------------------
     What are Q-type Operations?
    (1 row)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the deal. Is there a way to have strings tokenized in a line
HI, I have query like this final Query contractQuery = cgnDao.getEntityManager(). createNativeQuery(SELECT k.phrase, ak.type
I have 2 strings that I'd like to compare, and return the positions of
I have two strings and would like to display the difference between them. For
I have some strings that I am pulling out of a database and I
I have two strings and I would like to mix the characters from each
I have a phrase in English that looks like this: I have {0} dogs
I have some strings of xxh:yym format where xx is hours and yy is
I have several strings in the rough form: [some text] [some number] [some more
I have two strings <EM>is <i>love</i></EM>,<PARTITION /> and <EM>is <i>love</i>,<PARTITION /> I want a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.