Hi Jack,

Reproducing the email that specifies my requirement.

My requirement is that I should be able to search for a person , for example 
Tom Hanks, by either

1) the whole of first name (Tom)
2) or partial first name with prefix  (To )
3) or partial first name without prefix  ( om)
4) or the whole of surname ( Hanks)
5) or partial surname with prefix (Han)
6) or partial surname without prefix (ank)
7) or the whole name (Tom Hanks)
8) or partial first name with or without prefix and partial surname with or 
without prefix ( To Han , om ank)
9) All of the above as case insensitive search

Thanks in advance for your help

Regards,
Dinesh Babu

Regards,
Dinesh Babu.



-----Original Message-----
From: Jack Krupansky [mailto:j...@basetechnology.com]
Sent: 07 December 2014 02:04
To: solr-user@lucene.apache.org
Subject: Re: How to stop Solr tokenising search terms with spaces

AFAIK, partial word matching is not a common use case. Could you provide a 
citation to shows otherwise?

Solr does provide a "simple mechanism" for "phrase search" - just place your 
phrase in quotes.

If you wish to do something more complex, then of course the solution may be 
more complex.

The starting point would be for you to provide a more complete description of 
your use case, which is clearly not "simple phrase search".

Your most recent messages suggested that you want to match on partial words, 
but... you need to be more specific - don't make us try to guess your 
requirements. Feeding us partial requirements, one partial requirement at a 
time is not particularly effective.

Finally, are you really trying to match names within arbitrary text, or do you 
have a field that simply contains a complete name? Again, this comes back to 
providing us with more specific requirements. My guess, from your mention of 
LDAP, is that the field would contain only a name, but... that's me guessing 
when you need to be specific. Once this distinction is cleared up, we can then 
focus on solutions that work either for arbitrary text or single value fields.

-- Jack Krupansky

-----Original Message-----
From: Dinesh Babu
Sent: Saturday, December 6, 2014 7:17 PM
To: solr-user@lucene.apache.org
Subject: RE: How to stop Solr tokenising search terms with spaces


Just curious, why solr does not provide a simple mechanism to do a phrase
search ? It is a very common use case and it is very surprising that there
is no straight forward, at least I have not found one after so much
research,  way to do it in Solr.

Regards,
Dinesh


-----Original Message-----
From: Dinesh Babu [mailto:dinesh.b...@pb.com]
Sent: 05 December 2014 17:29
To: solr-user@lucene.apache.org
Subject: RE: How to stop Solr tokenising search terms with spaces

Hi Erik,

Probably I celebrated too soon. When I tested {!field} it seemed to work as
the query was on such a data that it made to look like it is working.  using
the example that I originally mentioned to search for Tom Hanks Major

1) If I search {!field f=displayName}: Hanks Major,  it works

2) If I provide partial word {!field f=displayName}: Hanks Ma,  it does not
work

Is this how {!field is designed to work?

Also I tried without and with escaping space as you suggested. It has the
same issue

1) q= field1:"Hanks Major" , it works
2) q= field1:"Hanks Maj" , does not works

Regards,
Dinesh Babu.



-----Original Message-----
From: Erik Hatcher [mailto:erik.hatc...@gmail.com]
Sent: 05 December 2014 16:44
To: solr-user@lucene.apache.org
Subject: Re: How to stop Solr tokenising search terms with spaces

But also, to spell out the more typical way to do that:

   q=field1:”…” OR field2:”…”

The nice thing about {!field} is that the value doesn’t have to have quotes
and deal with escaping issues, but if you just want phrase queries and
quote/escaping isn’t a hassle maybe that’s cleaner for you.

        Erik


> On Dec 5, 2014, at 11:30 AM, Dinesh Babu <dinesh.b...@pb.com> wrote:
>
> One more quick question Erik,
>
> If I want to do search on multiple fields using {!field} do we have a
> query similar to what  {!prefix} has
> :  q={!prefix f=field1 v=$f1_val} OR {!prefix f=field2 v=$f2_val} where
> &f1_val=<field 1 value>&f2_val=<field2 value>
>
> Regards,
> Dinesh Babu.
>
>
>
> -----Original Message-----
> From: Dinesh Babu
> Sent: 05 December 2014 16:26
> To: solr-user@lucene.apache.org
> Subject: RE: How to stop Solr tokenising search terms with spaces
>
> Thanks a lot Erik. {!field} seems to solve our issue. Much appreciate your
> help
>
>
> Regards,
> Dinesh Babu.
>
>
>
> -----Original Message-----
> From: Erik Hatcher [mailto:erik.hatc...@gmail.com]
> Sent: 05 December 2014 16:00
> To: solr-user@lucene.apache.org
> Subject: Re: How to stop Solr tokenising search terms with spaces
>
> try using {!field} instead of {!prefix}.  {!field} will create a phrase
> query (or term query if it’s just one term) after analysis.  [it also
> could construct other query types if the analysis overlaps tokens, but
> maybe not relevant here]
>
> Also note that you can use multiple of these expressions if needed:
> q={!prefix f=field1 v=$f1_val} OR {!prefix f=field2 v=$f2_val} where
> &f1_val=<field 1 value>&f2_val=<field2 value>
>
>        Erik
>
>
>
>> On Dec 5, 2014, at 10:45 AM, Dinesh Babu <dinesh.b...@pb.com> wrote:
>>
>> Hi,
>>
>> We are using Solr 4.10.2 to store user names from LDAP. I want Solr not
>> to tokenise my search term which has space in it Eg: If there is a user
>> by the name Tom Hanks Major, then
>>
>> 1) When I do a query for " Tom Hanks Major " , I don't want solr break
>> this search phrase and search for individual words (ie, Tom ,Hanks,
>> Major), but search for the whole phrase and get me the Tom Hanks Major
>> user
>>
>> 2) Also if I query for "Hanks Major" I should get the Tom Hanks Major
>> user back
>>
>> We used !prefix, but that does no allow the scenario 2. Also !prefix will
>> restrict the search to one field and can't do on mutiple fields. Any
>> solutions?
>>
>> Regards,
>> Dinesh Babu.
>>
>> ________________________________
>>
>
>
> ________________________________
>


________________________________


________________________________


________________________________

Reply via email to