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 Ralf Musick <ra...@gmx.de> on 2011/08/01 22:00:29 UTC

Spatial Search and Highlighting

Hi,

I combined a spatial distance search with a fulltext search as described 
in 
http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_function .
I'm using solr 3.3 and that works fine.
BUT, I want to use highlighting of fulltext query words but that does 
not work.

Before solr 3.3, I used solr 1.4 with Spatial Search plugin from Jteam 
and that works fine also with highlighting.

After refactoring because of API change I miss the highlighting feature.

Is that a known issue? Or what is my mistake/ I have to do?

Example Query:
INFO: [organisations] webapp=/solr path=/select 
params={hl.fragsize=250&sort=score+asc&sfield=store_lat_lon&json.nl=map&hl.fl=name,category_name&wt=json&hl=on&rows=10&fl=id,name,street,city,score,lat,lng&start=0&q={!func}geodist()&pt=52.5600917,13.4222482&fq=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisierung))^10+OR+(sub_category_name:+(automatisierung))^10} 
hits=37 status=0 QTime=7


Thanks is Advance,
  Ralf

Re: Spatial Search and Highlighting

Posted by Bill Bell <bi...@gmail.com>.
I think 4.0 supports fl=geodist()

On 8/1/11 3:47 PM, "Ralf Musick" <ra...@gmx.de> wrote:

>Hi David,
>
>So that "As a temporary workaround for older Solr versions, it's
>possible to obtain distances by using geodist or geofilt as the only
>scoring part of the main query"
>and "Highlighting" do not fit together, right?
>
>Ok, than I have to calculate the distance by my own.
>
>Thank you very much for your given information!!
>
>Best regards,
>  Ralf
>
>
>
>Am 01.08.2011 23:30, schrieb Smiley, David W.:
>> Ralf,
>>
>> Highlighting (and search relevancy -- the score) is performed on the
>>user query which must be in the "q" parameter.  In your case, I see you
>>placed your geospatial query there and you put your user query into a
>>filter query "fq".  You have them reversed.
>>
>> You stated that the "returning the distance" information on the wiki
>>didn't work -- that's because those instructions are for Solr 4.0 (not
>>released yet) -- notice the warning symbol. I recommend that you
>>calculate the distance yourself since Solr 4.0 isn't out yet. There is
>>plenty of information on the web on how to calculate the distance
>>between two lat-lon points using the Haversine algorithm.
>>
>> ~ David
>>
>> On Aug 1, 2011, at 5:00 PM, Ralf Musick wrote:
>>
>>> Hi David,
>>>
>>> an example is:
>>> 
>>>http://localhost:8983/solr/browse?indent=on&hl=on&hl.fl=name,manu&sort=s
>>>core+asc&sfield=store&json.nl=map&wt=json&rows=10&start=0&q={!func}geodi
>>>st%28%29&pt=45.17614%2C-93.87341&fq=%28name%20:+%28canon%29%29^8
>>>
>>> I have to say I need the calculated distance as a return field (score)
>>> in the result list.
>>> The pseudo field solution described here
>>> http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance did
>>>not
>>> word, so I created the query above.
>>>
>>> Thanks,
>>>   Ralf
>>>
>>>
>>> Am 01.08.2011 22:21, schrieb Smiley, David W.:
>>>> Can you demonstrate the bug against the example data?  If so, provide
>>>>the URL please.
>>>> ~ David
>>>>
>>>> On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I combined a spatial distance search with a fulltext search as
>>>>>described
>>>>> in
>>>>> 
>>>>>http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_funct
>>>>>ion .
>>>>> I'm using solr 3.3 and that works fine.
>>>>> BUT, I want to use highlighting of fulltext query words but that does
>>>>> not work.
>>>>>
>>>>> Before solr 3.3, I used solr 1.4 with Spatial Search plugin from
>>>>>Jteam
>>>>> and that works fine also with highlighting.
>>>>>
>>>>> After refactoring because of API change I miss the highlighting
>>>>>feature.
>>>>>
>>>>> Is that a known issue? Or what is my mistake/ I have to do?
>>>>>
>>>>> Example Query:
>>>>> INFO: [organisations] webapp=/solr path=/select
>>>>> 
>>>>>params={hl.fragsize=250&sort=score+asc&sfield=store_lat_lon&json.nl=ma
>>>>>p&hl.fl=name,category_name&wt=json&hl=on&rows=10&fl=id,name,street,cit
>>>>>y,score,lat,lng&start=0&q={!func}geodist()&pt=52.5600917,13.4222482&fq
>>>>>=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisier
>>>>>ung))^10+OR+(sub_category_name:+(automatisierung))^10}
>>>>> hits=37 status=0 QTime=7
>>>>>
>>>>>
>>>>> Thanks is Advance,
>>>>>   Ralf
>>
>



Re: Spatial Search and Highlighting

Posted by Ralf Musick <ra...@gmx.de>.
Hi David,

So that "As a temporary workaround for older Solr versions, it's 
possible to obtain distances by using geodist or geofilt as the only 
scoring part of the main query"
and "Highlighting" do not fit together, right?

Ok, than I have to calculate the distance by my own.

Thank you very much for your given information!!

Best regards,
  Ralf



Am 01.08.2011 23:30, schrieb Smiley, David W.:
> Ralf,
>
> Highlighting (and search relevancy -- the score) is performed on the user query which must be in the "q" parameter.  In your case, I see you placed your geospatial query there and you put your user query into a filter query "fq".  You have them reversed.
>
> You stated that the "returning the distance" information on the wiki didn't work -- that's because those instructions are for Solr 4.0 (not released yet) -- notice the warning symbol. I recommend that you calculate the distance yourself since Solr 4.0 isn't out yet. There is plenty of information on the web on how to calculate the distance between two lat-lon points using the Haversine algorithm.
>
> ~ David
>
> On Aug 1, 2011, at 5:00 PM, Ralf Musick wrote:
>
>> Hi David,
>>
>> an example is:
>> http://localhost:8983/solr/browse?indent=on&hl=on&hl.fl=name,manu&sort=score+asc&sfield=store&json.nl=map&wt=json&rows=10&start=0&q={!func}geodist%28%29&pt=45.17614%2C-93.87341&fq=%28name%20:+%28canon%29%29^8
>>
>> I have to say I need the calculated distance as a return field (score)
>> in the result list.
>> The pseudo field solution described here
>> http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance did not
>> word, so I created the query above.
>>
>> Thanks,
>>   Ralf
>>
>>
>> Am 01.08.2011 22:21, schrieb Smiley, David W.:
>>> Can you demonstrate the bug against the example data?  If so, provide the URL please.
>>> ~ David
>>>
>>> On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:
>>>
>>>> Hi,
>>>>
>>>> I combined a spatial distance search with a fulltext search as described
>>>> in
>>>> http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_function .
>>>> I'm using solr 3.3 and that works fine.
>>>> BUT, I want to use highlighting of fulltext query words but that does
>>>> not work.
>>>>
>>>> Before solr 3.3, I used solr 1.4 with Spatial Search plugin from Jteam
>>>> and that works fine also with highlighting.
>>>>
>>>> After refactoring because of API change I miss the highlighting feature.
>>>>
>>>> Is that a known issue? Or what is my mistake/ I have to do?
>>>>
>>>> Example Query:
>>>> INFO: [organisations] webapp=/solr path=/select
>>>> params={hl.fragsize=250&sort=score+asc&sfield=store_lat_lon&json.nl=map&hl.fl=name,category_name&wt=json&hl=on&rows=10&fl=id,name,street,city,score,lat,lng&start=0&q={!func}geodist()&pt=52.5600917,13.4222482&fq=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisierung))^10+OR+(sub_category_name:+(automatisierung))^10}
>>>> hits=37 status=0 QTime=7
>>>>
>>>>
>>>> Thanks is Advance,
>>>>   Ralf
>


Re: Spatial Search and Highlighting

Posted by "Smiley, David W." <ds...@mitre.org>.
Ralf,

Highlighting (and search relevancy -- the score) is performed on the user query which must be in the "q" parameter.  In your case, I see you placed your geospatial query there and you put your user query into a filter query "fq".  You have them reversed.  

You stated that the "returning the distance" information on the wiki didn't work -- that's because those instructions are for Solr 4.0 (not released yet) -- notice the warning symbol. I recommend that you calculate the distance yourself since Solr 4.0 isn't out yet. There is plenty of information on the web on how to calculate the distance between two lat-lon points using the Haversine algorithm.

~ David

On Aug 1, 2011, at 5:00 PM, Ralf Musick wrote:

> Hi David,
> 
> an example is:
> http://localhost:8983/solr/browse?indent=on&hl=on&hl.fl=name,manu&sort=score+asc&sfield=store&json.nl=map&wt=json&rows=10&start=0&q={!func}geodist%28%29&pt=45.17614%2C-93.87341&fq=%28name%20:+%28canon%29%29^8
> 
> I have to say I need the calculated distance as a return field (score) 
> in the result list.
> The pseudo field solution described here 
> http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance did not 
> word, so I created the query above.
> 
> Thanks,
>  Ralf
> 
> 
> Am 01.08.2011 22:21, schrieb Smiley, David W.:
>> Can you demonstrate the bug against the example data?  If so, provide the URL please.
>> ~ David
>> 
>> On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:
>> 
>>> Hi,
>>> 
>>> I combined a spatial distance search with a fulltext search as described
>>> in
>>> http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_function .
>>> I'm using solr 3.3 and that works fine.
>>> BUT, I want to use highlighting of fulltext query words but that does
>>> not work.
>>> 
>>> Before solr 3.3, I used solr 1.4 with Spatial Search plugin from Jteam
>>> and that works fine also with highlighting.
>>> 
>>> After refactoring because of API change I miss the highlighting feature.
>>> 
>>> Is that a known issue? Or what is my mistake/ I have to do?
>>> 
>>> Example Query:
>>> INFO: [organisations] webapp=/solr path=/select
>>> params={hl.fragsize=250&sort=score+asc&sfield=store_lat_lon&json.nl=map&hl.fl=name,category_name&wt=json&hl=on&rows=10&fl=id,name,street,city,score,lat,lng&start=0&q={!func}geodist()&pt=52.5600917,13.4222482&fq=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisierung))^10+OR+(sub_category_name:+(automatisierung))^10}
>>> hits=37 status=0 QTime=7
>>> 
>>> 
>>> Thanks is Advance,
>>>  Ralf
>> 
> 


Re: Spatial Search and Highlighting

Posted by Ralf Musick <ra...@gmx.de>.
Hi David,

an example is:
http://localhost:8983/solr/browse?indent=on&hl=on&hl.fl=name,manu&sort=score+asc&sfield=store&json.nl=map&wt=json&rows=10&start=0&q={!func}geodist%28%29&pt=45.17614%2C-93.87341&fq=%28name%20:+%28canon%29%29^8

I have to say I need the calculated distance as a return field (score) 
in the result list.
The pseudo field solution described here 
http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance did not 
word, so I created the query above.

Thanks,
  Ralf


Am 01.08.2011 22:21, schrieb Smiley, David W.:
> Can you demonstrate the bug against the example data?  If so, provide the URL please.
> ~ David
>
> On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:
>
>> Hi,
>>
>> I combined a spatial distance search with a fulltext search as described
>> in
>> http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_function .
>> I'm using solr 3.3 and that works fine.
>> BUT, I want to use highlighting of fulltext query words but that does
>> not work.
>>
>> Before solr 3.3, I used solr 1.4 with Spatial Search plugin from Jteam
>> and that works fine also with highlighting.
>>
>> After refactoring because of API change I miss the highlighting feature.
>>
>> Is that a known issue? Or what is my mistake/ I have to do?
>>
>> Example Query:
>> INFO: [organisations] webapp=/solr path=/select
>> params={hl.fragsize=250&sort=score+asc&sfield=store_lat_lon&json.nl=map&hl.fl=name,category_name&wt=json&hl=on&rows=10&fl=id,name,street,city,score,lat,lng&start=0&q={!func}geodist()&pt=52.5600917,13.4222482&fq=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisierung))^10+OR+(sub_category_name:+(automatisierung))^10}
>> hits=37 status=0 QTime=7
>>
>>
>> Thanks is Advance,
>>   Ralf
>


Re: Spatial Search and Highlighting

Posted by "Smiley, David W." <ds...@mitre.org>.
Can you demonstrate the bug against the example data?  If so, provide the URL please.
~ David

On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:

> Hi,
> 
> I combined a spatial distance search with a fulltext search as described 
> in 
> http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_function .
> I'm using solr 3.3 and that works fine.
> BUT, I want to use highlighting of fulltext query words but that does 
> not work.
> 
> Before solr 3.3, I used solr 1.4 with Spatial Search plugin from Jteam 
> and that works fine also with highlighting.
> 
> After refactoring because of API change I miss the highlighting feature.
> 
> Is that a known issue? Or what is my mistake/ I have to do?
> 
> Example Query:
> INFO: [organisations] webapp=/solr path=/select 
> params={hl.fragsize=250&sort=score+asc&sfield=store_lat_lon&json.nl=map&hl.fl=name,category_name&wt=json&hl=on&rows=10&fl=id,name,street,city,score,lat,lng&start=0&q={!func}geodist()&pt=52.5600917,13.4222482&fq=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisierung))^10+OR+(sub_category_name:+(automatisierung))^10} 
> hits=37 status=0 QTime=7
> 
> 
> Thanks is Advance,
>  Ralf