Results 1 to 4 of 4
  1. #1
    catch22 is offline Member
    Join Date
    Aug 2011
    Posts
    3
    Rep Power
    0

    Default phrase search with trailing wildcard

    From what I can read on other forums it seems the answer to my question is "cant be done", but my brain simply wont accept that. The type of query I want to be able to perform is not of the type
    "th* is n* pos*" matching ex. "this is not possible". I only need trailing wildcard, like "This is*" matching ex. "This is possible" or "This is not possible". Can this be behavior be simulated somehow, seing as it apparently isn't possible "out of the box" ?

  2. #2
    catch22 is offline Member
    Join Date
    Aug 2011
    Posts
    3
    Rep Power
    0

    Default

    You're suggesting I use the reqexQuery from lucene ?


    Quote Originally Posted by Fubarable View Post
    This should be easy to do. Why not use a simple regular expression (regex) and the String matches method to test your Strings? The regex could be as simple as "This is.*" if case matters.

  3. #3
    catch22 is offline Member
    Join Date
    Aug 2011
    Posts
    3
    Rep Power
    0

    Default

    I guess I wasn't being clear on the scenario I'm facing. I have a lucene index with thousands of documents I need to search. Searching with the term "this is no" gives no hits even if I have a document with a field containing "This is not possible". I can't add * to the term.

  4. #4
    Jayshri is offline Member
    Join Date
    Nov 2011
    Posts
    7
    Rep Power
    0

    Default Re: phrase search with trailing wildcard

    You can create search term like:
    String searchTerm = new String("This is"+"*");

    It will be contains search and it will give us results having text 'This is possible' or 'This is not possible'.

Similar Threads

  1. Alternative to phrase query?
    By Shweta_N in forum Lucene
    Replies: 0
    Last Post: 08-04-2011, 04:54 PM
  2. Phrase Meaning
    By griddle in forum New To Java
    Replies: 1
    Last Post: 04-25-2011, 06:45 PM
  3. Pbm in Generic WildCard?
    By makpandian in forum New To Java
    Replies: 1
    Last Post: 02-07-2011, 08:07 PM
  4. How to display WildCard search values
    By peliukasss in forum Lucene
    Replies: 1
    Last Post: 08-25-2010, 02:29 PM
  5. Shift Off Trailing Zeroes
    By nwboy74 in forum New To Java
    Replies: 5
    Last Post: 02-25-2010, 07:56 AM

Posting Permissions

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