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 Prathik Puthran <pr...@gmail.com> on 2013/06/18 11:59:23 UTC

Returning both partial and complete match results in solr

Hi,

I wanted to know if it is possible to tweak solr to return the results of
both complete and partial query matches.

For eg:
If the search query is "Brad Pitt" and if the query parser is "AND" Solr
returns all documents indexed against the term "Brad Pitt".
If the query parser is "OR" Solr returns all the documents indexed against
the term "Brad Pitt", "Brad", "Pitt".

I want to the Solr to return the data in a way such that all the results
matched by the "AND" parser (i.e. Complete match) should be in a seperate
key- value pair in JSON response.
i.e. "CompleteMatch :[doc1, doc2, doc3...]"
and all the partial matches which are not part of complete match should be
a seperate key-value pair in JSON response i.e.
"PartialMatch : [doc4, doc5, doc6].

How can I achieve this?

Thanks,
Prathik

Re: Returning both partial and complete match results in solr

Posted by Toke Eskildsen <te...@statsbiblioteket.dk>.
On Tue, 2013-06-18 at 12:17 +0200, Prathik Puthran wrote:
> The 2nd query returns the complete matches as well. So I will have to
> filter out the complete matches from the partial match results.

Without testing:
(Brad OR Pitt) NOT (Brad AND Pitt)

Although that does require you to parse the query from the user and
re-write it.


Re: Returning both partial and complete match results in solr

Posted by Prathik Puthran <pr...@gmail.com>.
The 2nd query returns the complete matches as well. So I will have to
filter out the complete matches from the partial match results.


On Tue, Jun 18, 2013 at 3:31 PM, Upayavira <uv...@odoko.co.uk> wrote:

> With two queries.
>
> I'm not sure there's another way to do it. Unless you were prepared to
> get coding, and implement another SearchComponent, but given that you
> can achieve it with two queries, that seems overkill to me.
>
> Upayavira
>
> On Tue, Jun 18, 2013, at 10:59 AM, Prathik Puthran wrote:
> > Hi,
> >
> > I wanted to know if it is possible to tweak solr to return the results of
> > both complete and partial query matches.
> >
> > For eg:
> > If the search query is "Brad Pitt" and if the query parser is "AND" Solr
> > returns all documents indexed against the term "Brad Pitt".
> > If the query parser is "OR" Solr returns all the documents indexed
> > against
> > the term "Brad Pitt", "Brad", "Pitt".
> >
> > I want to the Solr to return the data in a way such that all the results
> > matched by the "AND" parser (i.e. Complete match) should be in a seperate
> > key- value pair in JSON response.
> > i.e. "CompleteMatch :[doc1, doc2, doc3...]"
> > and all the partial matches which are not part of complete match should
> > be
> > a seperate key-value pair in JSON response i.e.
> > "PartialMatch : [doc4, doc5, doc6].
> >
> > How can I achieve this?
> >
> > Thanks,
> > Prathik
>

Re: Returning both partial and complete match results in solr

Posted by Upayavira <uv...@odoko.co.uk>.
With two queries. 

I'm not sure there's another way to do it. Unless you were prepared to
get coding, and implement another SearchComponent, but given that you
can achieve it with two queries, that seems overkill to me.

Upayavira

On Tue, Jun 18, 2013, at 10:59 AM, Prathik Puthran wrote:
> Hi,
> 
> I wanted to know if it is possible to tweak solr to return the results of
> both complete and partial query matches.
> 
> For eg:
> If the search query is "Brad Pitt" and if the query parser is "AND" Solr
> returns all documents indexed against the term "Brad Pitt".
> If the query parser is "OR" Solr returns all the documents indexed
> against
> the term "Brad Pitt", "Brad", "Pitt".
> 
> I want to the Solr to return the data in a way such that all the results
> matched by the "AND" parser (i.e. Complete match) should be in a seperate
> key- value pair in JSON response.
> i.e. "CompleteMatch :[doc1, doc2, doc3...]"
> and all the partial matches which are not part of complete match should
> be
> a seperate key-value pair in JSON response i.e.
> "PartialMatch : [doc4, doc5, doc6].
> 
> How can I achieve this?
> 
> Thanks,
> Prathik