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 "ssharma7884@gmail.com" <ss...@gmail.com> on 2015/06/30 15:28:49 UTC

Restricting fields returned by Suggester reult.

Hi,
Is it possible to restrict the result returned by Suggeter to "selected"
fields only?
i.e. Currently, Suggester returns data in following structure (XML),
Can I restrict the Solr (5.1) Suggestor to return ONLY "term" & EXCLUDE
<long name="weight"> &
 <str name="payload"/> as per Suggeter result XML below ?


<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">16</int>
</lst>
<lst name="suggest">
  <lst name="docNameSuggester">
    <lst name="document">
      <int name="numFound">5</int>
      <arr name="suggestions">
        <lst>
        *<str name="term">document</str>*
          <long name="weight">512409557603043072</long>
          <str name="payload"/>
        </lst>
        <lst>
          *<str name="term">document1</str>*
          <long name="weight">512409557603043072</long>
          <str name="payload"/>
        </lst>
        <lst>
          *<str name="term">document2</str>*
          <long name="weight">512409557603043072</long>
          <str name="payload"/>
        </lst>
        <lst>
          *<str name="term">document3</str>*
          <long name="weight">512409557603043072</long>
          <str name="payload"/>
        </lst>
        <lst>
          *<str name="term">document4</str>*
          <long name="weight">512409557603043072</long>
          <str name="payload"/>
        </lst>
      </arr>
    </lst>
  </lst>
  <lst name="textSuggester">
    <lst name="document">
      <int name="numFound">3</int>
      <arr name="suggestions">
        <lst>
          *<str name="term">document</str>*
          <long name="weight">10933347601771902</long>
          <str name="payload"/>
        </lst>
        <lst>
          *<str name="term">documents</str>*
          <long name="weight">4373339040708760</long>
          <str name="payload"/>
        </lst>
        <lst>
          *<str name="term">documenting</str>*
          <long name="weight">2186669520354380</long>
          <str name="payload"/>
        </lst>
      </arr>
    </lst>
  </lst>
</lst>
</response>


Regards,
Sachin Vyas.



--
View this message in context: http://lucene.472066.n3.nabble.com/Restricting-fields-returned-by-Suggester-reult-tp4214948.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Restricting fields returned by Suggester reult.

Posted by "ssharma7884@gmail.com" <ss...@gmail.com>.
Alessandro Benedetti,
Thanks for the reply, it answered my query.


Thanks,
Sachin Vyas.




--
View this message in context: http://lucene.472066.n3.nabble.com/Restricting-fields-returned-by-Suggester-reult-tp4214948p4215193.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Restricting fields returned by Suggester reult.

Posted by Alessandro Benedetti <be...@gmail.com>.
I think you don't have the Suggester Solr Component clear…
The suggester works on "terms" not on documents.
The results returned are a list of terms per dictionary.

Because we are not returning documents, you can not filter by field (
actually a suggester has knowledge of its Dictionary, not about fields).
You don't even have any information about fields in the suggester response.

You can select the terms that will appear in your dictionary configuring
the input field to use ( possibly a copy field if suggestions needed
without discrimation from different fields) .
Maybe this is what you meant.

Knowing that, you can understand your question is quite obscure.
Giving this knowledge, are you able to reformulate better your real problem
?


2015-07-01 6:54 GMT+01:00 ssharma7884@gmail.com <ss...@gmail.com>:

> Alessandro Benedetti,
> Thanks for the update.
>
> Actually, what I meant by - "Is it possible to restrict the result returned
> by Suggeter to "selected"
> fields only?" was like option of "fl" available for querying (/select) in
> Solr, wherein there could be some fields as defined in "schema.xml", but we
> can pick & choose what we require. This would in effect reduce the amount
> of
> data sent from server.
>
>
> Regards,
> Sachin Vyas.
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Restricting-fields-returned-by-Suggester-reult-tp4214948p4215132.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Re: Restricting fields returned by Suggester reult.

Posted by "ssharma7884@gmail.com" <ss...@gmail.com>.
Alessandro Benedetti,
Thanks for the update.

Actually, what I meant by - "Is it possible to restrict the result returned
by Suggeter to "selected" 
fields only?" was like option of "fl" available for querying (/select) in
Solr, wherein there could be some fields as defined in "schema.xml", but we
can pick & choose what we require. This would in effect reduce the amount of
data sent from server.


Regards,
Sachin Vyas.




--
View this message in context: http://lucene.472066.n3.nabble.com/Restricting-fields-returned-by-Suggester-reult-tp4214948p4215132.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Restricting fields returned by Suggester reult.

Posted by Alessandro Benedetti <be...@gmail.com>.
Actually what you are asking does not make any sense.
Solr response is returning that data structure because it must return as
much as possible.
It is responsibility of the client to get what it needs from the response.

Talking about the Java Client, I contributed the SolrJ code to parse the
Suggester response[1].
I will provide a final patch soon.
With my implementationn it is possible to use SolrJ to give you a simple
List of String for the suggested terms.

[1] https://issues.apache.org/jira/browse/SOLR-7719

Cheers

2015-06-30 14:28 GMT+01:00 ssharma7884@gmail.com <ss...@gmail.com>:

> Hi,
> Is it possible to restrict the result returned by Suggeter to "selected"
> fields only?
> i.e. Currently, Suggester returns data in following structure (XML),
> Can I restrict the Solr (5.1) Suggestor to return ONLY "term" & EXCLUDE
> <long name="weight"> &
>  <str name="payload"/> as per Suggeter result XML below ?
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <response>
>
> <lst name="responseHeader">
>   <int name="status">0</int>
>   <int name="QTime">16</int>
> </lst>
> <lst name="suggest">
>   <lst name="docNameSuggester">
>     <lst name="document">
>       <int name="numFound">5</int>
>       <arr name="suggestions">
>         <lst>
>         *<str name="term">document</str>*
>           <long name="weight">512409557603043072</long>
>           <str name="payload"/>
>         </lst>
>         <lst>
>           *<str name="term">document1</str>*
>           <long name="weight">512409557603043072</long>
>           <str name="payload"/>
>         </lst>
>         <lst>
>           *<str name="term">document2</str>*
>           <long name="weight">512409557603043072</long>
>           <str name="payload"/>
>         </lst>
>         <lst>
>           *<str name="term">document3</str>*
>           <long name="weight">512409557603043072</long>
>           <str name="payload"/>
>         </lst>
>         <lst>
>           *<str name="term">document4</str>*
>           <long name="weight">512409557603043072</long>
>           <str name="payload"/>
>         </lst>
>       </arr>
>     </lst>
>   </lst>
>   <lst name="textSuggester">
>     <lst name="document">
>       <int name="numFound">3</int>
>       <arr name="suggestions">
>         <lst>
>           *<str name="term">document</str>*
>           <long name="weight">10933347601771902</long>
>           <str name="payload"/>
>         </lst>
>         <lst>
>           *<str name="term">documents</str>*
>           <long name="weight">4373339040708760</long>
>           <str name="payload"/>
>         </lst>
>         <lst>
>           *<str name="term">documenting</str>*
>           <long name="weight">2186669520354380</long>
>           <str name="payload"/>
>         </lst>
>       </arr>
>     </lst>
>   </lst>
> </lst>
> </response>
>
>
> Regards,
> Sachin Vyas.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Restricting-fields-returned-by-Suggester-reult-tp4214948.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England