Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to search?

 
malik ge
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am trying to make a search page in JSP.
I am able to search, with full text.

For example in my database I have different question titles.
  • Jsp failed to execute in Netbeans
  • UrlEncode the String
  • <c:set> jstl

  • when I enter the full title, the search is successful.

    Now if anyone could please tell me, how to make a search without entering the whole title.
    For example,
    if I enter "JSP failed to execute" I could get the search result.

    Thanks
     
    Deepak Bala
    Bartender
    Posts: 6663
    5
    Firefox Browser Linux MyEclipse IDE
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Are you querying the database to get the result ? In that case an expensive wildcard like %your_text_here% will do the trick. But it is not ideal.

    Using an API like lucene to perform searches on an full text index will provide better results.

    PS: What does this have to do with JSP ?
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 64973
    86
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Nothing to do with JSP. Moved to the JDBC forum.
     
    Karthik Shiraly
    Bartender
    Posts: 1208
    25
    Android C++ Java Linux PHP Python
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Malik,

    MySQL and PostgreSql provide fairly competent text search support through SQL statements, that are more efficient and accurate than LIKE operator.
    Typically, the only changes required in existing applications are:
    - Create appropriate DB indexes.
    - Modify SQL queries sent by application

    While PostgreSql provides tsquery and tssupport SQL operators, MySql provides the MATCH...AGAINST SQL clause.

    Between these two, PostgreSql's support is more powerful and feature rich than MySql. MySql unfortunately imposes a lot of conditions to support text search ( the worst of which is that storage engine for table being searched has to be non-transactional MyISAM). Neither is as powerful and accurate as a dedicated search framework like lucene/solr, but then maybe you don't need that level of accuracy.

    Another option, if you're using Hibernate or can integrate it, is the Hibernate Search addon. It integrates Lucene transparently with DB updates, which means your app design doesn't have to change much (other than adding some annotations and modifying Hibernate queries).
     
    Rosary Albert
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    hi am rosary
    am java beginner i want to creat search engine in java is there an idea?
     
    Karthik Shiraly
    Bartender
    Posts: 1208
    25
    Android C++ Java Linux PHP Python
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Rosary Albert wrote:hi am rosary
    am java beginner i want to creat search engine in java is there an idea?


    Hi Rosary, you'll have to provide more details about what you want the search engine to do and what data it should search.
     
    malik ge
    Ranch Hand
    Posts: 69
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks for reply.

    I think I ma gonna go with "Deepak Bala".
    I have been able to search with

    Now I want to know how to search it through Java?
    I have tried using it like this:


    but it did not work...
    any help?
     
    Paul Clapham
    Sheriff
    Posts: 21137
    32
    Eclipse IDE Firefox Browser MySQL Database
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
     
    malik ge
    Ranch Hand
    Posts: 69
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    "Paul Clapham" thanks alot...
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic