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 Pawel Rog <pa...@gmail.com> on 2014/12/11 11:12:51 UTC

Highlighting integer field

Hi,
Is it possible to highlight int (TrieLongField) or long (TrieLongField)
field in Solr?

--
Paweł

Re: Highlighting integer field

Posted by Tomoko Uchida <to...@gmail.com>.
I did not know about LUCENE-3080. (and take a look now)
So discussion seems to be beyond user mailing list, but thank you for your
information.

Regards,
Tomoko

2014-12-12 21:04 GMT+09:00 Pawel <pa...@gmail.com>:
>
> Hi again,
> When I removed those lines from DefaultSolrHighlighter and rebuilt Solr it
> seems to work.
>
>     final SchemaField schemaField = schema.getFieldOrNull(fieldName);
>     if (schemaField != null && ((schemaField.getType() instanceof
> org.apache.solr.schema.TrieField)
>             || (schemaField.getType() instanceof
> org.apache.solr.schema.TrieDateField))) {
>       return;
>     }
>
> There is still information about LUCENE-3080 in comments (and this JIRA
> issue is still open)  but some other issue seems to be resolved: SOLR-2497
> which says it is blocked by LUCENE-3080.
>
>
> On Fri, Dec 12, 2014 at 12:51 PM, Tomoko Uchida <
> tomoko.uchida.1111@gmail.com> wrote:
> >
> > Hi,
> >
> > As Mike have pointed, there is no way to highlight numeric fields.
> > If you want to highlight, you have to index them as *text* field. It's
> not
> > about Solr, but Lucene.
> >
> > (Maybe it's possible to "highlight" them in application layer, server
> side
> > program or client side JavaScript, rather than Solr?)
> >
> > --
> > Tomoko
> >
> >
> > 2014-12-12 18:27 GMT+09:00 Pawel <pa...@gmail.com>:
> > >
> > > Hi,
> > > Thanks for your response. Do you maybe have an idea how to handle
> > integers
> > > (even on low level - Lucene) in highlighter?
> > >
> > > --
> > > Paweł
> > >
> > > On Fri, Dec 12, 2014 at 12:28 AM, Michael Sokolov <
> > > msokolov@safaribooksonline.com> wrote:
> > > >
> > > > So the short answer to your original question is "no." Highlighting
> is
> > > > designed to find matches *within* a tokenized (text) field only.
> That
> > is
> > > > difficult because text gets processed and there are all sorts of
> > > > complications, but for integers it should be pretty easy to match the
> > > > values in the document and those in the query in the client, ie
> without
> > > > help from Solr?
> > > >
> > > > -Mike
> > > >
> > > >
> > > > On 12/11/14 6:19 PM, Pawel wrote:
> > > >
> > > >> Hi,
> > > >> Thanks for response. It is quite important to me for example to
> > > highlight
> > > >> multivalued field with many int or long tokens.
> > > >>
> > > >> --
> > > >> Paweł
> > > >>
> > > >> On Thu, Dec 11, 2014 at 3:08 PM, Tomoko Uchida <
> > > >> tomoko.uchida.1111@gmail.com
> > > >>
> > > >>> wrote:
> > > >>>
> > > >>> Hi Pawel,
> > > >>>
> > > >>> Essentially, highlighting is a feature to show "fragments of
> > documents"
> > > >>> that matche user queries.
> > > >>> With that, he/she can find occurrence of their query in long
> > documents
> > > >>> and
> > > >>> can understand their results well.
> > > >>>
> > > >>> For tint or tlong fields (or other non-text field types),
> "fragments"
> > > >>> usually have no meaning.
> > > >>>
> > > >>> So, excuse me, I cannot understand your intent.
> > > >>> If you specify your need a little bit more, I or other fellows may
> be
> > > >>> able
> > > >>> to help you.
> > > >>>
> > > >>> Regards,
> > > >>> Tomoko
> > > >>>
> > > >>> 2014-12-11 19:12 GMT+09:00 Pawel Rog <pa...@gmail.com>:
> > > >>>
> > > >>>  Hi,
> > > >>>> Is it possible to highlight int (TrieLongField) or long
> > > (TrieLongField)
> > > >>>> field in Solr?
> > > >>>>
> > > >>>> --
> > > >>>> Paweł
> > > >>>>
> > > >>>>
> > > >
> > >
> >
>

Re: Highlighting integer field

Posted by Pawel <pa...@gmail.com>.
Hi again,
When I removed those lines from DefaultSolrHighlighter and rebuilt Solr it
seems to work.

    final SchemaField schemaField = schema.getFieldOrNull(fieldName);
    if (schemaField != null && ((schemaField.getType() instanceof
org.apache.solr.schema.TrieField)
            || (schemaField.getType() instanceof
org.apache.solr.schema.TrieDateField))) {
      return;
    }

There is still information about LUCENE-3080 in comments (and this JIRA
issue is still open)  but some other issue seems to be resolved: SOLR-2497
which says it is blocked by LUCENE-3080.


On Fri, Dec 12, 2014 at 12:51 PM, Tomoko Uchida <
tomoko.uchida.1111@gmail.com> wrote:
>
> Hi,
>
> As Mike have pointed, there is no way to highlight numeric fields.
> If you want to highlight, you have to index them as *text* field. It's not
> about Solr, but Lucene.
>
> (Maybe it's possible to "highlight" them in application layer, server side
> program or client side JavaScript, rather than Solr?)
>
> --
> Tomoko
>
>
> 2014-12-12 18:27 GMT+09:00 Pawel <pa...@gmail.com>:
> >
> > Hi,
> > Thanks for your response. Do you maybe have an idea how to handle
> integers
> > (even on low level - Lucene) in highlighter?
> >
> > --
> > Paweł
> >
> > On Fri, Dec 12, 2014 at 12:28 AM, Michael Sokolov <
> > msokolov@safaribooksonline.com> wrote:
> > >
> > > So the short answer to your original question is "no." Highlighting is
> > > designed to find matches *within* a tokenized (text) field only.  That
> is
> > > difficult because text gets processed and there are all sorts of
> > > complications, but for integers it should be pretty easy to match the
> > > values in the document and those in the query in the client, ie without
> > > help from Solr?
> > >
> > > -Mike
> > >
> > >
> > > On 12/11/14 6:19 PM, Pawel wrote:
> > >
> > >> Hi,
> > >> Thanks for response. It is quite important to me for example to
> > highlight
> > >> multivalued field with many int or long tokens.
> > >>
> > >> --
> > >> Paweł
> > >>
> > >> On Thu, Dec 11, 2014 at 3:08 PM, Tomoko Uchida <
> > >> tomoko.uchida.1111@gmail.com
> > >>
> > >>> wrote:
> > >>>
> > >>> Hi Pawel,
> > >>>
> > >>> Essentially, highlighting is a feature to show "fragments of
> documents"
> > >>> that matche user queries.
> > >>> With that, he/she can find occurrence of their query in long
> documents
> > >>> and
> > >>> can understand their results well.
> > >>>
> > >>> For tint or tlong fields (or other non-text field types), "fragments"
> > >>> usually have no meaning.
> > >>>
> > >>> So, excuse me, I cannot understand your intent.
> > >>> If you specify your need a little bit more, I or other fellows may be
> > >>> able
> > >>> to help you.
> > >>>
> > >>> Regards,
> > >>> Tomoko
> > >>>
> > >>> 2014-12-11 19:12 GMT+09:00 Pawel Rog <pa...@gmail.com>:
> > >>>
> > >>>  Hi,
> > >>>> Is it possible to highlight int (TrieLongField) or long
> > (TrieLongField)
> > >>>> field in Solr?
> > >>>>
> > >>>> --
> > >>>> Paweł
> > >>>>
> > >>>>
> > >
> >
>

Re: Highlighting integer field

Posted by Tomoko Uchida <to...@gmail.com>.
Hi,

As Mike have pointed, there is no way to highlight numeric fields.
If you want to highlight, you have to index them as *text* field. It's not
about Solr, but Lucene.

(Maybe it's possible to "highlight" them in application layer, server side
program or client side JavaScript, rather than Solr?)

--
Tomoko


2014-12-12 18:27 GMT+09:00 Pawel <pa...@gmail.com>:
>
> Hi,
> Thanks for your response. Do you maybe have an idea how to handle integers
> (even on low level - Lucene) in highlighter?
>
> --
> Paweł
>
> On Fri, Dec 12, 2014 at 12:28 AM, Michael Sokolov <
> msokolov@safaribooksonline.com> wrote:
> >
> > So the short answer to your original question is "no." Highlighting is
> > designed to find matches *within* a tokenized (text) field only.  That is
> > difficult because text gets processed and there are all sorts of
> > complications, but for integers it should be pretty easy to match the
> > values in the document and those in the query in the client, ie without
> > help from Solr?
> >
> > -Mike
> >
> >
> > On 12/11/14 6:19 PM, Pawel wrote:
> >
> >> Hi,
> >> Thanks for response. It is quite important to me for example to
> highlight
> >> multivalued field with many int or long tokens.
> >>
> >> --
> >> Paweł
> >>
> >> On Thu, Dec 11, 2014 at 3:08 PM, Tomoko Uchida <
> >> tomoko.uchida.1111@gmail.com
> >>
> >>> wrote:
> >>>
> >>> Hi Pawel,
> >>>
> >>> Essentially, highlighting is a feature to show "fragments of documents"
> >>> that matche user queries.
> >>> With that, he/she can find occurrence of their query in long documents
> >>> and
> >>> can understand their results well.
> >>>
> >>> For tint or tlong fields (or other non-text field types), "fragments"
> >>> usually have no meaning.
> >>>
> >>> So, excuse me, I cannot understand your intent.
> >>> If you specify your need a little bit more, I or other fellows may be
> >>> able
> >>> to help you.
> >>>
> >>> Regards,
> >>> Tomoko
> >>>
> >>> 2014-12-11 19:12 GMT+09:00 Pawel Rog <pa...@gmail.com>:
> >>>
> >>>  Hi,
> >>>> Is it possible to highlight int (TrieLongField) or long
> (TrieLongField)
> >>>> field in Solr?
> >>>>
> >>>> --
> >>>> Paweł
> >>>>
> >>>>
> >
>

Re: Highlighting integer field

Posted by Pawel <pa...@gmail.com>.
Hi,
Thanks for your response. Do you maybe have an idea how to handle integers
(even on low level - Lucene) in highlighter?

--
Paweł

On Fri, Dec 12, 2014 at 12:28 AM, Michael Sokolov <
msokolov@safaribooksonline.com> wrote:
>
> So the short answer to your original question is "no." Highlighting is
> designed to find matches *within* a tokenized (text) field only.  That is
> difficult because text gets processed and there are all sorts of
> complications, but for integers it should be pretty easy to match the
> values in the document and those in the query in the client, ie without
> help from Solr?
>
> -Mike
>
>
> On 12/11/14 6:19 PM, Pawel wrote:
>
>> Hi,
>> Thanks for response. It is quite important to me for example to highlight
>> multivalued field with many int or long tokens.
>>
>> --
>> Paweł
>>
>> On Thu, Dec 11, 2014 at 3:08 PM, Tomoko Uchida <
>> tomoko.uchida.1111@gmail.com
>>
>>> wrote:
>>>
>>> Hi Pawel,
>>>
>>> Essentially, highlighting is a feature to show "fragments of documents"
>>> that matche user queries.
>>> With that, he/she can find occurrence of their query in long documents
>>> and
>>> can understand their results well.
>>>
>>> For tint or tlong fields (or other non-text field types), "fragments"
>>> usually have no meaning.
>>>
>>> So, excuse me, I cannot understand your intent.
>>> If you specify your need a little bit more, I or other fellows may be
>>> able
>>> to help you.
>>>
>>> Regards,
>>> Tomoko
>>>
>>> 2014-12-11 19:12 GMT+09:00 Pawel Rog <pa...@gmail.com>:
>>>
>>>  Hi,
>>>> Is it possible to highlight int (TrieLongField) or long (TrieLongField)
>>>> field in Solr?
>>>>
>>>> --
>>>> Paweł
>>>>
>>>>
>

Re: Highlighting integer field

Posted by Michael Sokolov <ms...@safaribooksonline.com>.
So the short answer to your original question is "no." Highlighting is 
designed to find matches *within* a tokenized (text) field only.  That 
is difficult because text gets processed and there are all sorts of 
complications, but for integers it should be pretty easy to match the 
values in the document and those in the query in the client, ie without 
help from Solr?

-Mike

On 12/11/14 6:19 PM, Pawel wrote:
> Hi,
> Thanks for response. It is quite important to me for example to highlight
> multivalued field with many int or long tokens.
>
> --
> Paweł
>
> On Thu, Dec 11, 2014 at 3:08 PM, Tomoko Uchida <tomoko.uchida.1111@gmail.com
>> wrote:
>>
>> Hi Pawel,
>>
>> Essentially, highlighting is a feature to show "fragments of documents"
>> that matche user queries.
>> With that, he/she can find occurrence of their query in long documents and
>> can understand their results well.
>>
>> For tint or tlong fields (or other non-text field types), "fragments"
>> usually have no meaning.
>>
>> So, excuse me, I cannot understand your intent.
>> If you specify your need a little bit more, I or other fellows may be able
>> to help you.
>>
>> Regards,
>> Tomoko
>>
>> 2014-12-11 19:12 GMT+09:00 Pawel Rog <pa...@gmail.com>:
>>
>>> Hi,
>>> Is it possible to highlight int (TrieLongField) or long (TrieLongField)
>>> field in Solr?
>>>
>>> --
>>> Paweł
>>>


Re: Highlighting integer field

Posted by Pawel <pa...@gmail.com>.
Hi,
Thanks for response. It is quite important to me for example to highlight
multivalued field with many int or long tokens.

--
Paweł

On Thu, Dec 11, 2014 at 3:08 PM, Tomoko Uchida <tomoko.uchida.1111@gmail.com
> wrote:
>
> Hi Pawel,
>
> Essentially, highlighting is a feature to show "fragments of documents"
> that matche user queries.
> With that, he/she can find occurrence of their query in long documents and
> can understand their results well.
>
> For tint or tlong fields (or other non-text field types), "fragments"
> usually have no meaning.
>
> So, excuse me, I cannot understand your intent.
> If you specify your need a little bit more, I or other fellows may be able
> to help you.
>
> Regards,
> Tomoko
>
> 2014-12-11 19:12 GMT+09:00 Pawel Rog <pa...@gmail.com>:
>
> > Hi,
> > Is it possible to highlight int (TrieLongField) or long (TrieLongField)
> > field in Solr?
> >
> > --
> > Paweł
> >
>

Re: Highlighting integer field

Posted by Tomoko Uchida <to...@gmail.com>.
Hi Pawel,

Essentially, highlighting is a feature to show "fragments of documents"
that matche user queries.
With that, he/she can find occurrence of their query in long documents and
can understand their results well.

For tint or tlong fields (or other non-text field types), "fragments"
usually have no meaning.

So, excuse me, I cannot understand your intent.
If you specify your need a little bit more, I or other fellows may be able
to help you.

Regards,
Tomoko

2014-12-11 19:12 GMT+09:00 Pawel Rog <pa...@gmail.com>:

> Hi,
> Is it possible to highlight int (TrieLongField) or long (TrieLongField)
> field in Solr?
>
> --
> Paweł
>