In fact there is an FAQ entry Can I combine wildcard and phrase
search, e.g. "foo ba*"? at
http://wiki.apache.org/lucene-java/LuceneFAQ#Can_I_combine_wildcard_and_phrase_search.2C_e.g._.22foo_ba.2A.22.3F
which suggests you extend the QueryParser to build a MultiPhraseQuery.
 There's also ComplexPhraseQueryParser which looks interesting.


--
Ian.


On Wed, Jul 4, 2012 at 9:51 AM, Ian Lea <ian....@gmail.com> wrote:
> Where exactly are you using these double quoted strings?  QueryParser?
>  It would help if you showed a code snippet.
>
> Assuming your real data is more complex and the strings you are
> searching for aren't necessarily at the start of the text, you'll need
> some mix of wildcard and proximity searching.  I don't think that "foo
> ba*"~n
> will work but I'm sure you'll be able to do it with a SpanQuery or
> six.  SpanNearQuery lets you specify slop and whether you care if
> matches are in order or not.
>
> See http://www.lucidimagination.com/blog/2009/07/18/the-spanquery/ for
> info on spans.
>
> See also 
> http://wiki.apache.org/lucene-java/LuceneFAQ#Why_am_I_getting_no_hits_.2BAC8_incorrect_hits.3F
> for good tips on figuring out why things aren't doing what you want.
>
> Good luck.
>
>
> --
> Ian.
>
>
> On Wed, Jul 4, 2012 at 7:11 AM, Hiren Shah <hiren.t.s...@gmail.com> wrote:
>> I have used standardAnalyser to save the ANALYZED data in index.
>>
>> Data is as below:-
>>
>>    1. foo bag test
>>    2. foo bar test
>>    3. bar india foo
>>
>>
>> I used
>> When  i search using--------------->  foo ba
>> I get all results when  i use ------->(+foo* +ba*)
>>
>>    1. I tried using "foo ba" (with double quotes)  but no results come as
>>    it searches for exact word
>>    2. I tried using "foo ba*" (with double quotes)  but no results come as
>>    it searches for exact word
>>    3. I tried using "foo bar" (with double quotes)  Then 2nd result comes
>>    as both words are completed
>>
>> What should be done to get  options 1 and 2 in results when user types foo
>> ba*. I dont want 3rd result but want 1st 2 results.
>> Please help.
>>
>> Thanks
>> Hiren

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to