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 ravicv <ra...@gmail.com> on 2009/12/01 06:13:51 UTC

Re: Phrase Query Issue

Thanks Erick But their any way to get phrase search and normal search
together.

for Example if I search for "test" it should only give test result but not
tests..
And if we search for tests it should give all results matching with
tests(this should include stemmer results also)

Please clarify me how normally this scenario is implemented?

I am using field title with text type which contains
SnowballPorterFilterFactory filter.

And another field title_exact with out SnowballPorterFilterFactory filter.

Both are copied using copy field.

	 <copyField source="title" dest="text"/>
	 <copyField source="title_exact" dest="text_exact"/>
But as text type is having a SnowballPorterFilterFactory filter it stores
tests as test.So always if I search for "test" tests also will come in my
search result.
Please tell me a way to avoid it.

Thanks
Ravichandra
-- 
View this message in context: http://old.nabble.com/Phrase-Query-Issue-tp22863529p26586788.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Phrase Query Issue

Posted by Erick Erickson <er...@gmail.com>.
Well, I don't think this is done normally. I'm assuming here that
you've simplified the example and your *real* requirements aren't
quite what you're showing, because what you've described seems
really confusing to a user.

That said, I don't think SOLR has a way to handle this out-of-the-box.
What you're asking for is for the query to search different fields based
on the *results* of the parsing. You have to deal with someone searching
for "tests" OR "run", which presumably should return anything
with "test", "tests", "testing", "run". But should NOT return a doc
with only "running" in the title. But to the parser, this starts out as
title:(tests run)....

So, you really need to see the results of feeding any term through
the stemmer. If it comes back the same as what you fed in, go
against one field. If it comes back stemmed, go against a
different field.

You'll probably have to create a custom parser that pre-processes
each term and determines which field should be searched, search
the SOLR list as creating custom parsers has been discussed
before by people more knowledgeable than me...

If my assumption that there are parts of this problem that you've
simplified is NOT correct, perhaps you could explain the use-case
that leads to this requirement....

But if anyone has a better idea, now's the time to speak up <G>.

Best
Erick

On Tue, Dec 1, 2009 at 12:13 AM, ravicv <ra...@gmail.com> wrote:

>
> Thanks Erick But their any way to get phrase search and normal search
> together.
>
> for Example if I search for "test" it should only give test result but not
> tests..
> And if we search for tests it should give all results matching with
> tests(this should include stemmer results also)
>
> Please clarify me how normally this scenario is implemented?
>
> I am using field title with text type which contains
> SnowballPorterFilterFactory filter.
>
> And another field title_exact with out SnowballPorterFilterFactory filter.
>
> Both are copied using copy field.
>
>         <copyField source="title" dest="text"/>
>         <copyField source="title_exact" dest="text_exact"/>
> But as text type is having a SnowballPorterFilterFactory filter it stores
> tests as test.So always if I search for "test" tests also will come in my
> search result.
> Please tell me a way to avoid it.
>
> Thanks
> Ravichandra
> --
> View this message in context:
> http://old.nabble.com/Phrase-Query-Issue-tp22863529p26586788.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>