You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Radha Krishna Reddy <ra...@gmail.com> on 2011/10/25 11:46:31 UTC

prefix search

Hi,

when i indexed words like 'Joe Tom' and 'Terry'.When i do prefix query like
q=t*,i get both 'Joe Tom' and Terry' as the results.But i want the result
for the complete string that start with 'T'.means i want only 'Terry' as the
result.

Can i do this?

Thanks and Regards,
Radha Krishna.

Re: prefix search

Posted by Michael Kuhlmann <ku...@solarier.de>.
I think what Radha Krishna (is this really her name?) means is different:

She wants to return only the matching token instead of the complete
field value.

Indeed, this is not possible. But you could use highlighting
(http://wiki.apache.org/solr/HighlightingParameters), and then extract
the matching part on your own. This shouldn't be too complicated.

-Kuli

Am 25.10.2011 12:12, schrieb Alireza Salimi:
> That's because the phrases are being tokenized and then indexed by Solr.
> You have to define a new fieldType which is not tokenized.
> http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.KeywordTokenizerFactory
> 
> I'm not sure if it would solve your problem
> 
> On Tue, Oct 25, 2011 at 5:46 AM, Radha Krishna Reddy <
> radhakrishnars@gmail.com> wrote:
> 
>> Hi,
>>
>> when i indexed words like 'Joe Tom' and 'Terry'.When i do prefix query like
>> q=t*,i get both 'Joe Tom' and Terry' as the results.But i want the result
>> for the complete string that start with 'T'.means i want only 'Terry' as
>> the
>> result.
>>
>> Can i do this?
>>
>> Thanks and Regards,
>> Radha Krishna.
>>
> 
> 
> 


Re: prefix search

Posted by Alireza Salimi <al...@gmail.com>.
That's because the phrases are being tokenized and then indexed by Solr.
You have to define a new fieldType which is not tokenized.
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.KeywordTokenizerFactory

I'm not sure if it would solve your problem

On Tue, Oct 25, 2011 at 5:46 AM, Radha Krishna Reddy <
radhakrishnars@gmail.com> wrote:

> Hi,
>
> when i indexed words like 'Joe Tom' and 'Terry'.When i do prefix query like
> q=t*,i get both 'Joe Tom' and Terry' as the results.But i want the result
> for the complete string that start with 'T'.means i want only 'Terry' as
> the
> result.
>
> Can i do this?
>
> Thanks and Regards,
> Radha Krishna.
>



-- 
Alireza Salimi
Java EE Developer