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 Prasanna Josium <pr...@clustr.co.in> on 2016/07/12 08:24:16 UTC

Return docs with only the matched fields for a query

Hi all,

My  requirement is in line with https://issues.apache.org/jira/browse/SOLR-3955
I'm working on a project that has very low network bandwidth for the clients.
I'm using Solr 4.10 

The problem: 
I have ~ 1M documents with multiple fields(~50),  many of them are indexed, stored and some of them are multivalued.
Queries are searched across all these fields and often, only a few of the fields have matching terms in them.  

When I search for a term="Hobbit", I want to return documents only with the matching fields where "Hobbit" is found. 
All other un matched fields in the result doc shall be dropped from the result set.

Naïve solution:
The obvious solution I could think of was to implement a custom search component based on the "Highlighter" component to filter out unwanted fields.
But I'm not sure of the performance penalty for large number of fields  or many multi valued fields / document.

Question:
Is there a better way to solve this problem? Apparently I'm not the first person facing such an issue.

Thanks
Cheers
Prasanna 





Re: Return docs with only the matched fields for a query

Posted by cole worldforsolr <co...@gmail.com>.
Hi Josium,

Have to try something like this
http://localhost:8983/solr/mycollection/select?fq=Hobbit:*&indent=on&q=*:*&wt=json

This will return all documents that contain the field Hobbit ONLY.

Well, I'm not very sure to understand what you seeking for, excuse me if my
answer is out of topic.

Best regards,
Cole.
On Tue, Jul 12, 2016 at 9:24 AM, Prasanna Josium <
prasanna.josium@clustr.co.in> wrote:

> Hi all,
>
> My  requirement is in line with
> https://issues.apache.org/jira/browse/SOLR-3955
> I'm working on a project that has very low network bandwidth for the
> clients.
> I'm using Solr 4.10
>
> The problem:
> I have ~ 1M documents with multiple fields(~50),  many of them are
> indexed, stored and some of them are multivalued.
> Queries are searched across all these fields and often, only a few of the
> fields have matching terms in them.
>
> When I search for a term="Hobbit", I want to return documents only with
> the matching fields where "Hobbit" is found.
> All other un matched fields in the result doc shall be dropped from the
> result set.
>
> Naïve solution:
> The obvious solution I could think of was to implement a custom search
> component based on the "Highlighter" component to filter out unwanted
> fields.
> But I'm not sure of the performance penalty for large number of fields  or
> many multi valued fields / document.
>
> Question:
> Is there a better way to solve this problem? Apparently I'm not the first
> person facing such an issue.
>
> Thanks
> Cheers
> Prasanna
>
>
>
>
>

Re: Return docs with only the matched fields for a query

Posted by Walter Underwood <wu...@wunderwood.org>.
I’m not sure you need a custom component. Try using the standard highlighter. Configure hl.simple.pre and hl.simple.post to be empty strings. Configure it to return one maximum length snippet. That should return the entire matching fields, though I haven’t tested it.

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)


> On Jul 12, 2016, at 1:24 AM, Prasanna Josium <pr...@clustr.co.in> wrote:
> 
> Hi all,
> 
> My  requirement is in line with https://issues.apache.org/jira/browse/SOLR-3955
> I'm working on a project that has very low network bandwidth for the clients.
> I'm using Solr 4.10 
> 
> The problem: 
> I have ~ 1M documents with multiple fields(~50),  many of them are indexed, stored and some of them are multivalued.
> Queries are searched across all these fields and often, only a few of the fields have matching terms in them.  
> 
> When I search for a term="Hobbit", I want to return documents only with the matching fields where "Hobbit" is found. 
> All other un matched fields in the result doc shall be dropped from the result set.
> 
> Naïve solution:
> The obvious solution I could think of was to implement a custom search component based on the "Highlighter" component to filter out unwanted fields.
> But I'm not sure of the performance penalty for large number of fields  or many multi valued fields / document.
> 
> Question:
> Is there a better way to solve this problem? Apparently I'm not the first person facing such an issue.
> 
> Thanks
> Cheers
> Prasanna 
> 
> 
> 
>