File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes how to search? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to search?" Watch "how to search?" New topic
Author

how to search?

malik ge
Ranch Hand

Joined: May 13, 2011
Posts: 69
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

    Joined: Feb 24, 2006
    Posts: 6662
        
        5

    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 ?


    SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61769
        
      67

    Nothing to do with JSP. Moved to the JDBC forum.


    [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    Karthik Shiraly
    Ranch Hand

    Joined: Apr 04, 2009
    Posts: 539
        
        7
    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

    Joined: Aug 08, 2011
    Posts: 1
    hi am rosary
    am java beginner i want to creat search engine in java is there an idea?
    Karthik Shiraly
    Ranch Hand

    Joined: Apr 04, 2009
    Posts: 539
        
        7
    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

    Joined: May 13, 2011
    Posts: 69
    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
    Bartender

    Joined: Oct 14, 2005
    Posts: 18992
        
        8

    malik ge
    Ranch Hand

    Joined: May 13, 2011
    Posts: 69
    "Paul Clapham" thanks alot...
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: how to search?