Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    6

    Unanswered: How to search in postgresql

    Hello!

    I'm having problems figuring out how i can actually do the following:

    Let's say i enter the following into a searchfield:

    Sam Orc

    The expected result should be

    Sam in Orc Armour

    However, i am not able to build a query which will actually return that.

    It only works when i enter Sam or Orc, but not both.

    So, my question is, how can i create a search engine which will do keyword searches in PostgreSQL?

    So, just so everybody understands what i mean:

    Imagine a table with the following data

    id | title
    ---------
    1 | Orc Warrior
    2 | Elf Bowman
    3 | Sam and Frodo in Orc Armour

    Now imagine a fom where you can enter a search phrase, and let's say i put in Sam Orc and hit the search button.

    What i want to have the search query return is Sam and Frodo in Orc Armour.

    Is this possible?

    Thanks a lot in advance for your time and patience!

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: How to search in postgresql

    Originally posted by datune
    Hello!

    I'm having problems figuring out how i can actually do the following:

    Let's say i enter the following into a searchfield:

    Sam Orc

    The expected result should be

    Sam in Orc Armour

    However, i am not able to build a query which will actually return that.

    It only works when i enter Sam or Orc, but not both.

    So, my question is, how can i create a search engine which will do keyword searches in PostgreSQL?

    So, just so everybody understands what i mean:

    Imagine a table with the following data

    id | title
    ---------
    1 | Orc Warrior
    2 | Elf Bowman
    3 | Sam and Frodo in Orc Armour

    Now imagine a fom where you can enter a search phrase, and let's say i put in Sam Orc and hit the search button.

    What i want to have the search query return is Sam and Frodo in Orc Armour.

    Is this possible?

    Thanks a lot in advance for your time and patience!
    You have following two options:

    1. Solving problem in Application tier
    2. Solving problem in Dtabase tier

    Solution for second problem has name FULLTEXT SEARCH.
    Look at: http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/

  3. #3
    Join Date
    Jan 2004
    Posts
    6
    thanks, but i already solved it

  4. #4
    Join Date
    Dec 2003
    Posts
    11
    that's interesting

    i suppose it was a regular expression..
    may i ask what does the sql query look like?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •