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 Peter Sturge <pe...@gmail.com> on 2014/12/08 23:22:25 UTC

Get matched Term in join query

Hi Forum,

Is it possible for a Solr query to return the term(s) that matched a
particular field/query?

For example, let's say there's a field like this:
raw="This is a raw text field that happens to contain some text that's also
in the action field value..."

And another field in a different index like this:
action="contain"

And they are tokenized on whitespace.

If my query is:
q={!join from=action to=raw fromIndex=TheActionIndex}*

If 'action' was in the same index, it would be ok, but
the problem is the match in 'TheActionIndex' isn't returned as it's in a
different index.

The query returns matching raw documents, but not *which* term was matched
to cause it to be returned.
I've tried the highlighting trick, but that doesn't work here - it returns
highlighting on all terms.
It would be great to get these back as facets, but getting them back at all
would be great.

Is it possible to have the query return which term(s) from 'raw' actually
matched the value in 'action'?
Maybe an extended TermsComponent to add only matched terms to the response
payload or similar?

Many thanks,
Peter

Re: Get matched Term in join query

Posted by Peter Sturge <pe...@gmail.com>.
Hi,

Your question is a good one - I have added an option to search through
results and filter that way, but it's not ideal, as very often there are
10,000 or millions of hits, with only 20 results per page returned.

I've realized I run into the classic 'Terms-can't-filtered' issue. To
filter Terms would, in the worst case, mean looking up a great many items.
For now, I'm going with the TermsComponent added to the standard
searchhandler. The drawback is you get back all terms that match the
terms.regex, even those not necessarily in the results.

Many thanks,
Peter



On Tue, Dec 9, 2014 at 7:32 AM, Mikhail Khludnev <mkhludnev@griddynamics.com
> wrote:

> Hello Peter,
>
> Let's limit or just fix the problem definition. I've got that dealing with
> cross core join id mandatory. Is it right?
> Then, do you need facets (from all resultset) or just a snippets (just from
> result page)?
> 09.12.2014 1:23 пользователь "Peter Sturge" <pe...@gmail.com>
> написал:
>
> > Hi Forum,
> >
> > Is it possible for a Solr query to return the term(s) that matched a
> > particular field/query?
> >
> > For example, let's say there's a field like this:
> > raw="This is a raw text field that happens to contain some text that's
> also
> > in the action field value..."
> >
> > And another field in a different index like this:
> > action="contain"
> >
> > And they are tokenized on whitespace.
> >
> > If my query is:
> > q={!join from=action to=raw fromIndex=TheActionIndex}*
> >
> > If 'action' was in the same index, it would be ok, but
> > the problem is the match in 'TheActionIndex' isn't returned as it's in a
> > different index.
> >
> > The query returns matching raw documents, but not *which* term was
> matched
> > to cause it to be returned.
> > I've tried the highlighting trick, but that doesn't work here - it
> returns
> > highlighting on all terms.
> > It would be great to get these back as facets, but getting them back at
> all
> > would be great.
> >
> > Is it possible to have the query return which term(s) from 'raw' actually
> > matched the value in 'action'?
> > Maybe an extended TermsComponent to add only matched terms to the
> response
> > payload or similar?
> >
> > Many thanks,
> > Peter
> >
>

Re: Get matched Term in join query

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Hello Peter,

Let's limit or just fix the problem definition. I've got that dealing with
cross core join id mandatory. Is it right?
Then, do you need facets (from all resultset) or just a snippets (just from
result page)?
09.12.2014 1:23 пользователь "Peter Sturge" <pe...@gmail.com>
написал:

> Hi Forum,
>
> Is it possible for a Solr query to return the term(s) that matched a
> particular field/query?
>
> For example, let's say there's a field like this:
> raw="This is a raw text field that happens to contain some text that's also
> in the action field value..."
>
> And another field in a different index like this:
> action="contain"
>
> And they are tokenized on whitespace.
>
> If my query is:
> q={!join from=action to=raw fromIndex=TheActionIndex}*
>
> If 'action' was in the same index, it would be ok, but
> the problem is the match in 'TheActionIndex' isn't returned as it's in a
> different index.
>
> The query returns matching raw documents, but not *which* term was matched
> to cause it to be returned.
> I've tried the highlighting trick, but that doesn't work here - it returns
> highlighting on all terms.
> It would be great to get these back as facets, but getting them back at all
> would be great.
>
> Is it possible to have the query return which term(s) from 'raw' actually
> matched the value in 'action'?
> Maybe an extended TermsComponent to add only matched terms to the response
> payload or similar?
>
> Many thanks,
> Peter
>