How to tell which field matched?

2010-05-14 Thread Tim Garton
All,
    I've searched around for help with something we are trying to do
and haven't come across much.  We are running solr 1.4.  Here is a
summary of the issue we are facing:

A simplified example of our schema is something like this:

  
  
  
  
  
  

When someone does a search we search across the title,
supplement_title, and supplement_pdf_text fields.  When we get our
results, we would like to be able to tell which field the search
matched and if it's a multiValued field, which of the multiple values
matched.  This is so that we can display results similar to:

   Example Title
       Example Supplement Title
       Example Supplement Title 2 (your search matched this document)
       Example Supplement Title 3

   Example Title 2
       Example Supplement Title 4
       Example Supplement Title 5
       Example Supplement Title 6 (your search matched this document)

   etc.

How would you recommend doing this?  Is there some way to get solr to
tell us which field matched, including multiValued fields?  As a
workaround we have been using highlighting to tell which field
matched, but it doesn't get us what we want for multiValued fields and
there is a significant cost to enabling the highlighting.  Should we
design our schema in some other fashion to achieve these results?
Thanks.

-Tim


Re: Autosuggest

2010-05-14 Thread Tim Garton
I think terms component is the recommended way.  That's how we have
implemented it and from the solr wiki page
http://wiki.apache.org/solr/TermsComponent:

... each term. This can be useful for doing auto-suggest or other
things that operate ...

Have to be careful how you filter the field during indexing though,
otherwise you can get weird suggestions based on latin roots (due to
stemming stuff) among other things.  We used something like:

  





  

-Tim

On Fri, May 14, 2010 at 2:39 PM, Blargy  wrote:
>
> What is the preferred way to implement this feature? Using facets or the
> terms component (or maybe something entirely different). Thanks in advance!
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Autosuggest-tp818430p818430.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: How to tell which field matched?

2010-05-15 Thread Tim Garton
Additionally, I don't think this gets us what we want with multiValued
fields.  It tells if a multiValued field matched, but not which value
out of the multiple values matched.  I am beginning to suspect that
this information can't be returned and we may have to restructure our
schema.

-Tim

On Sat, May 15, 2010 at 7:12 AM, Sascha Szott  wrote:
> Hi,
>
> I'm not sure if debugQuery=on is a feasible solution in a productive
> environment, as generating such extra information requires a reasonable
> amount of computation.
>
> -Sascha
>
> Jon Baer wrote:
>>
>> Does the standard debug component (?debugQuery=on) give you what you need?
>>
>>
>> http://wiki.apache.org/solr/SolrRelevancyFAQ#Why_does_id:archangel_come_before_id:hawkgirl_when_querying_for_.22wings.22
>>
>> - Jon
>>
>> On May 14, 2010, at 4:03 PM, Tim Garton wrote:
>>
>>> All,
>>>     I've searched around for help with something we are trying to do
>>> and haven't come across much.  We are running solr 1.4.  Here is a
>>> summary of the issue we are facing:
>>>
>>> A simplified example of our schema is something like this:
>>>
>>>   >> required="true" />
>>>   >> required="true" />
>>>   
>>>   >> stored="true" multiValued="true" />
>>>   >> stored="true" multiValued="true" />
>>>   >> stored="true" multiValued="true" />
>>>
>>> When someone does a search we search across the title,
>>> supplement_title, and supplement_pdf_text fields.  When we get our
>>> results, we would like to be able to tell which field the search
>>> matched and if it's a multiValued field, which of the multiple values
>>> matched.  This is so that we can display results similar to:
>>>
>>>    Example Title
>>>        Example Supplement Title
>>>        Example Supplement Title 2 (your search matched this document)
>>>        Example Supplement Title 3
>>>
>>>    Example Title 2
>>>        Example Supplement Title 4
>>>        Example Supplement Title 5
>>>        Example Supplement Title 6 (your search matched this document)
>>>
>>>    etc.
>>>
>>> How would you recommend doing this?  Is there some way to get solr to
>>> tell us which field matched, including multiValued fields?  As a
>>> workaround we have been using highlighting to tell which field
>>> matched, but it doesn't get us what we want for multiValued fields and
>>> there is a significant cost to enabling the highlighting.  Should we
>>> design our schema in some other fashion to achieve these results?
>>> Thanks.
>>>
>>> -Tim
>>
>
>